https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64698
Bug ID: 64698
Summary: preprocessor ignores #pragma GCC diagnostic when using
-save-temps
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: markus at oberhumer dot com
This could be related to bug 53431, though this report is about C and not C++.
Actually I had thought that "-save-temps" just dumps the internal state, but
that does not seem to be true.
The following code:
#pragma GCC diagnostic ignored "-Wundef"
#if FOO
#endif
int main (void) { return 42; }
compiled with
gcc-4.9 -Wundef -Werror -save-temps -c bug_wundef.c
gives:
bug_wundef.c:2:5: error: "FOO" is not defined [-Werror=undef]
#if FOO
^
cc1: all warnings being treated as errors
On the contrary
gcc-4.9 -Wundef -Werror -c bug_wundef.c
does not give any error.