pragma GCC diagnostic ignored "-Wundef"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a problem with undef and diagnostic pragma and I am not sure if I am 
doing something wrong or it's a GCC bug.

The following code:

#pragma GCC diagnostic ignored "-Wundef"
#if FOO
#endif
int main (void) { return 42; }

compiled in this way:

gcc -o test test.c -Wundef -Werror

does not give any error.
On the contrary if I compile it with g++

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

gcc version is:
gcc (Debian 4.7.0-8) 4.7.0

Why does preprocessor have this different behavior?




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux