Patrick Horgan - Re: How do I find when the diagnostic pragmas first came into gcc? (original) (raw)

This is the mail archive of the gcc-help@gcc.gnu.orgmailing list for the GCC project.

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