[cfe-dev] -Wheader-guard emits warning after #undef of guard macro

Prathamesh Kulkarni bilbotheelffriend at gmail.com
Mon Jan 13 03:06:23 PST 2014


For the following test-case:
#ifndef FOO
#define FOO2

#undef FOO2
#endif

-Wheader-guard emits warning:
./foo.h:4:9: warning: 'FOO' is used as a header guard here, followed
by #define of a different macro [-Wheader-guard]
#ifndef FOO
        ^~~
./foo.h:5:9: note: 'FOO2' is defined here; did you mean 'FOO'?
#define FOO2
        ^~~~

Is this appropriate or should it suppress warning in this case
since it's equivalent to the following: ?
#ifndef FOO
#endif

Thanks and Regards,
Prathamesh



More information about the cfe-dev mailing list