On 02/20/13 16:44, Kevin Wolf wrote: > On Wed, Feb 20, 2013 at 04:33:50PM +0100, Laszlo Ersek wrote:
>> (a) #pragma PP_TOKEN1 PP_TOKEN2 ..., where PP_TOKEN1 is not STDC, has >> implementation-defined effect. (Ie. the platform can do whatever it >> wants, but has to document it). Non-STDC #pragmas that are not >> recognized by the implementation must be ignored (C99 6.10.6p1 >> requirement). So wrapping "#pragma GCC diagnostic" is not really useful: >> non-gcc compilers will surely not recognize "#pragma GCC whatever", and >> an older gcc (not recognizing "#pragma GCC diagnostic") is required to >> ignore it. > > gcc produces a warning for unknown pragmas, and -Werror turns it into an > error, so it's not quite useless. (To be quashed with -Wno-unknown-pragmas ;)) >> (b) My main point was, if you build on a gcc which understands >> -Wstrict-prototypes and chokes on gtkitemfactory.h, but doesn't >> understand the #pragma, then compilation will fail. >> >> I think that on such a platform "qemu-pixman.h" / <pixman.h> from >> pixman-0.16.0 would fail to parse as well. > > I think you're right here. When I originally introduced the first one of > these, I had to deal with a new warning in 4.6, so this was obviously > not a problem. But qemu-pixman.h as well as this one can't rely on it. > > Maybe we need to remove -Werror if configure detects that the #pragma > doesn't work. Sounds good to me. I assume developers (who should care the most about warnings) work with recent toolstacks (in RHEL-6.3 for example, devtoolset-1.1 ships gcc-4.7.2 (+patches)), hence the #pragma would work for them. For users building qemu on an older toolstack (where the #pragma would not be recognized and suppress the warning) the warning should not be fatal. Clang was also mentioned, I'm not sure about it. I suppose clang wishes to be UI-compatible with gcc (that's why it supports the -W* options), so maybe they'll pick up the #pragma too in time?... Thanks Laszlo