On 08/30/10 17:48, Anthony Liguori wrote: > On 08/30/2010 10:43 AM, Jes Sorensen wrote: >> Yes it's technically legal. However it's painful when you try to apply >> more aggressive warning flags looking for real bugs. > > No, this is GCC being stupid. > >> I would suggest we modify the coding style to ask people to not init a >> struct like this. >> > > How else do you terminate a list? IOW: > > MyDeviceInfo device_infos[] = { > {"foo", 0, 2}, > {"bar", 0, 1}, > {} /* or { 0 } */ > }; > > This is such a pervasive idiom that there's simply no way that GCC can > possibly try to warn against this. Plus, it's entirely reasonable. > > I think this is just a false positive in GCC. Otherwise, there's a ton > of code that it should be throwing warnings against
I believe the comma after the last case takes care of terminating the list. I agree that it would be nice to get gcc to not moan about this specific case, however I will argue that my change is worth it to be able to use the error flags, even if it is gcc being stupid. Cheers, Jes