[Bug c++/53431] New: C++ preprocessor ignores #pragma GCC diagnostic ignored "-Wundef"

ml.lattuada at libero dot it gcc-bugzilla@gcc.gnu.org
Mon May 21 08:03:00 GMT 2012


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: unassigned@gcc.gnu.org
        ReportedBy: ml.lattuada@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



More information about the Gcc-bugs mailing list