[Bug c/64175] New: #pragma GCC diagnostic pop doesn't re-disable -Wnested-externs
plokinom at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Dec 3 21:14:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64175
Bug ID: 64175
Summary: #pragma GCC diagnostic pop doesn't re-disable
-Wnested-externs
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: plokinom at gmail dot com
$ cat foo.c
#pragma GCC diagnostic warning "-Wnested-externs"
#pragma GCC diagnostic pop
static void bar(void) { extern int main(void); }
int main(void) { return 0; }
$ gcc foo.c
foo.c: In function ‘bar’:
foo.c:3:1: warning: nested extern declaration of ‘main’ [-Wnested-externs]
static void bar(void) { extern int main(void); }
^
I think this is a bug because according to the documentation "If a 'pop' has no
matching 'push', the command-line options are restored" and there is no
-Wnested-externs on the command line, so gcc shouldn't warn.
More information about the Gcc-bugs
mailing list