On 10 January 2011 21:35, Patrick Horgan wrote: > I'm documenting the use of the diagnostic pragmas: > > |#pragma GCC diagnostic |kind option > |#pragma GCC diagnostic push| > |#pragma GCC diagnostic pop| > > on a boost page talking about how developers might deal with gcc warnings > and was wondering how to figure out what test I could put into a #if that > would avoid trying to use these pragmas in releases that did not support > them yet. > > Something like: > > #if defined(__GNUC__) > #pragma GCC diagnostic push > #pragma GCC diagnostic ignored "-Wformat" > #endif > > // code here that generates a spurious warning controlled by -Wformat > > #if defined(__GNUC__) > #pragma GCC diagnostic pop > #endif You read the manual, obviously. http://gcc.gnu.org/onlinedocs/ The Diagnostic Pragmas section in each release tells you what's supported: http://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Diagnostic-Pragmas.html http://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/Diagnostic-Pragmas.html http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Diagnostic-Pragmas.html