How do I find when the diagnostic pragmas first came into gcc?

Patrick Horgan
Mon Jan 10 21:35:00 GMT 2011

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"

// code here that generates a spurious warning controlled by -Wformat

#if defined(__GNUC__)
#pragma GCC diagnostic pop

More information about the Gcc-help mailing list