Fix __label__ handling
a) __label__ in gcc is not a type, it's a statement. Accepted in the beginning of compound-statement, has form __label__ ident-list;
b) instead of crapping into NS_SYMBOL namespace (and consequent shadowing issues), reassign the namespace to NS_LABEL after we'd bound it. We'll get block scope and label namespace, i.e. what we get in gcc.
c) MOD_LABEL can be dropped now.
Signed-off-by Al Viro <[email protected]>
--- gdbhelpers | 3 -- ident-list.h | 1 + parse.c | 55 ++++++++++++++++++++++----------------------- symbol.h | 1 - validation/label-scope.c | 12 ++++++++++ 5 files changed, 40 insertions(+), 32 deletions(-) create mode 100644 validation/label-scope.c
gdbhelpers +0 -3
@@ -146,9 +146,6 @@ define gdb_show_ctype if ($arg0->modifiers & MOD_TOPLEVEL) printf "MOD_TOPLEVEL " end - if ($arg0->modifiers & MOD_LABEL) - printf "MOD_LABEL " - end if ($arg0->modifiers & MOD_ASSIGNED) printf "MOD_ASSIGNED " end
ident-list.h +1 -0
@@ -31,6 +31,7 @@ IDENT(alignof); IDENT_RESERVED(__alignof); IDENT_RESERVED(__alignof__);IDENT_RESERVED (__sizeof_ptr__);IDENT_RESERVED (__builtin_types_compatible_p);IDENT_RESERVED (__builtin_offsetof); +IDENT_RESERVED (__label__);/* Attribute names */ IDENT (packed);IDENT (__packed__ );
parse.c +27 -28
82 lines not on this page · raw message
symbol.h +0 -1
@@ -207,7 +207,6 @@ struct symbol {#define MOD_ACCESSED 0x400000#define MOD_TOPLEVEL 0x800000 // scoping.. -#define MOD_LABEL 0x1000000#define MOD_ASSIGNED 0x2000000#define MOD_TYPE 0x4000000#define MOD_SAFE 0x8000000 // non-null/non-trapping pointer
validation/label-scope.c new file +12 -0
@@ -0,0 +1,12 @@ +static int f (int n) +{ +__label__ n; +n:return n; +} +static int g (int n) +{ +n:return n; +} +/* +* check-name: __label__ scope +*/
Signature · 1 line
1.5.6.5