https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78538
Bug ID: 78538
Summary: system header diagnostic for enum with a define is not
good
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
t.c:
#define a 1024
#include "t.h"
---- CUT ----
t.h:
#pragma GCC system_header
enum
{
a = 1024
};
---- CUT ----
We only get:
t.c:1:11: error: expected identifier before numeric constant
#define a 1024
^
With -save-temps, we get:
In file included from t.c:2:0:
t.h:4:2: error: expected identifier before numeric constant
a = 1024
^~~~
Which is better.
If we did not have pragma GCC system_header in t.h we get:
t.c:1:11: error: expected identifier before numeric constant
#define a 1024
^
t.h:4:3: note: in expansion of macro ‘a’
a = 1024
^
Which is what you expect in the first place.