Rewrite and fix specifiers handling
PATCH 13/18 Rewrite and fix specifiers handling
Make sure that we accept the right set; kill ad-hackery around checks for banned combinations. Instead of that we keep a bitmap describing what we'd already seen (with several extra bits for 'long long' and for keeping track of can't-combine-with-anything stuff), check and update it using the values in ..._op and keep track of size modifiers more or less explicitly.
Testcases added. A _lot_ of that used to be done wrong.
Note that __attribute__((mode(...))) got more broken by this one; the next several changesets will take care of that.
One more thing: we are -><- close to getting rid of MOD_SPECIFIER bits for good.
--- ident-list.h | 1 + parse.c | 365 ++++++++++++++++++++++++++-------------------- parse.h | 1 - symbol.h | 12 +- validation/specifiers1.c | 101 +++++++++++++ validation/specifiers2.c | 152 +++++++++++++++++++ 6 files changed, 467 insertions(+), 165 deletions(-) create mode 100644 validation/specifiers1.c create mode 100644 validation/specifiers2.c
ident-list.h +1 -0
@@ -23,6 +23,7 @@ IDENT(union);IDENT (enum);IDENT (__attribute);IDENT (__attribute__);IDENT (volatile);IDENT (__volatile);IDENT (__volatile__); +IDENT (double);/* Extended gcc identifiers */ IDENT (asm);IDENT_RESERVED (__asm);IDENT_RESERVED (__asm__);
parse.c +207 -160
474 lines not on this page · raw message
parse.h +0 -1
@@ -128,7 +128,6 @@ extern int show_expression(struct expression *);extern struct token *external_declaration (struct token *token,struct symbol_list **list);extern struct symbol *ctype_integer (unsigned long spec); -extern struct symbol *ctype_fp (unsigned long spec);extern void copy_statement (struct statement *src,struct statement *dst);extern int inline_function (struct expression *expr,struct symbol *sym);
symbol.h +7 -5
@@ -64,11 +64,11 @@ enum keyword {KW_MODIFIER =1 <<1 ,KW_QUALIFIER =1 <<2 ,KW_ATTRIBUTE =1 <<3 , -KW_TYPEOF =1 <<4 , -KW_STATEMENT =1 <<5 , -KW_ASM =1 <<6 , -KW_MODE =1 <<7 , - KW_SPEC = 1 << 8, +KW_STATEMENT =1 <<4 , +KW_ASM =1 <<5 , +KW_MODE =1 <<6 , +KW_SHORT =1 <<7 , + KW_LONG = 1 << 8, }; struct context {
@@ -105,6 +105,8 @@ struct symbol_op {struct token *(*statement)(struct token *token,struct statement *stmt);struct token *(*toplevel)(struct token *token,struct symbol_list **list);struct token *(*attribute)(struct token *token,struct symbol *attr,struct ctype *ctype); + +int test, set, class; };extern int expand_safe_p (struct expression *expr,int cost);
validation/specifiers1.c new file +101 -0
101 lines not on this page · raw message
validation/specifiers2.c new file +152 -0
152 lines not on this page · raw message
Signature · 1 line
1.5.6.5