http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
Bug #: 53431 Summary: C++ preprocessor ignores #pragma GCC diagnostic ignored "-Wundef" Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: ml.lattu...@libero.it The following code: #pragma GCC diagnostic ignored "-Wundef" #if FOO #endif int main (void) { return 42; } compiled with g++ -o test test.c -Wundef -Werror gives: test.c:2:5: error: "FOO" is not defined [-Werror=undef] cc1plus: all warnings being treated as errors On the contrary gcc -o test test.c -Wundef -Werror does not give any error gcc version is gcc (Debian 4.7.0-8) 4.7.0