
Juergen Hunold wrote:
With modern gcc (read: 4.3 and higher), you can use the following:
-----------snip--------- #if defined(__GNUC__) #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif
void foo(int bar { }
+#if defined(__GNUC__) + #pragma GCC diagnostic warning "-Wdeprecated-declarations" +#endif --------------------------------------------------------
The GCC docs say: "Also, while it is syntactically valid to put these pragmas anywhere in your sources, the only supported location for them is before any data or functions are defined. Doing otherwise may result in unpredictable results depending on how the optimizer manages your sources." This might only mean you can't use them inside functions or class definitions, but it seems to imply that using them after a function definition leads to undefined behavior. Thus, even if we knew what setting to turn the warning back to (perhaps the warning wasn't enabled in the first place!), we might not be able to turn them back on. --Jeffrey Bosboom