Tim Rühsen wrote: > It works, but... ;-) OK, I've pushed it.
> Your patch disables that warning for the whole file. IMO, we should keep > the scope of the #pragma as narrow as possible. > > We could have a pragma.h include file with the following C99 code (I > leave the clang and gcc version checks to you): > > #define STRINGIFY(a) #a > > #if defined __clang__ > # define NOWARN(a) _Pragma( STRINGIFY( clang diagnostic ignored a ) ) > # define NOWARN_PUSH(a) \ > _Pragma( STRINGIFY( clang diagnostic push ) ) \ > _Pragma( STRINGIFY( clang diagnostic ignored a ) ) > # define NOWARN_POP _Pragma( STRINGIFY( gcc diagnostic pop ) ) > #elif defined __GNUC__ > # define NOWARN(a) _Pragma( STRINGIFY( gcc diagnostic ignored a ) ) > # define NOWARN_PUSH(a) \ > _Pragma( STRINGIFY( gcc diagnostic push ) ) \ > _Pragma( STRINGIFY( gcc diagnostic ignored a ) ) > # define NOWARN_POP _Pragma( STRINGIFY( gcc diagnostic pop ) ) > #else > # define NOWARN > # define NOWARN_PUSH > # define NOWARN_POP > #endif Indeed such macrology belongs in one single file. Would you like to provide a patch? The macros should cater for the case the gcc and clang have different warning options (see e.g. anytostr.c). Also if NOWARN and NOWARN_PUSH take an argument in one case, they need to take an argument in the #else case as well. Bruno