Re: 2.6.12-rc5-mm1: drivers/media/dvb/dvb-usb/a800.c compile error

From: Johannes Stezenbach
Date: Mon May 30 2005 - 04:16:49 EST


On Mon, May 30, 2005 at 10:29:26AM +0200, Patrick Boettcher wrote:
> On Sun, 29 May 2005, Adrian Bunk wrote:
> >It seems this patch is responsible for the following compile error with
> >gcc 2.95:
...
> The attached patch solves the problem by adding a '0' to the array
> declaration. I don't know if this is ethically correct, but I saw it in
> some v4l-code, so I assume it is.
...
> - struct dvb_usb_device_description devices[];
> + struct dvb_usb_device_description devices[0];

That can't work in this context. Did you even try to compile?

.../dibusb-mb.c:178: warning: excess elements in array initializer
.../dibusb-mb.c:178: warning: (near initialization for `dibusb1_1_properties.devices')

The solution below wastes a few 100 bytes of space, but I think we can
live with that. The same thing was done in dvb-pll.h.
---
gcc-2.95 compile fix.

Signed-off-by: Patrick Boettcher <pb@xxxxxxxxxxx>
Signed-off-by: Johannes Stezenbach <js@xxxxxxxxxxx>

Index: linux/drivers/media/dvb/dvb-usb/dvb-usb.h
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/dvb-usb/dvb-usb.h,v
retrieving revision 1.16
diff -u -p -r1.16 dvb-usb.h
--- linux/drivers/media/dvb/dvb-usb/dvb-usb.h 2 May 2005 12:48:01 -0000 1.16
+++ linux/drivers/media/dvb/dvb-usb/dvb-usb.h 30 May 2005 09:09:30 -0000
@@ -193,7 +193,7 @@ struct dvb_usb_properties {
} urb;

int num_device_descs;
- struct dvb_usb_device_description devices[];
+ struct dvb_usb_device_description devices[8];
};


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/