aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/parse.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-10-07 06:24:25 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-12-29 14:39:38 +0100
commitc2922bf8df232fd30adff7ee4314fdbe1f73db87 (patch)
tree8e2d877734d50266e200235a05ff1fd7cd52720e /parse.c
parenta9444f64ed60b14b0cb379091be0e5e05d3fffa8 (diff)
downloadsparse-dev-c2922bf8df232fd30adff7ee4314fdbe1f73db87.tar.gz
struct-attr: prepare to handle attributes at the end of struct definitions (1)
Type attributes for struct can be placed either just after the keyword 'struct' or after the '}' ending its definition but this later case is currently ignored. Prepare the handling of this by factoring the code common to both cases in a single place. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/parse.c b/parse.c
index d6343f0e..41d3eb1f 100644
--- a/parse.c
+++ b/parse.c
@@ -745,12 +745,10 @@ static struct token *struct_union_enum_specifier(enum type type,
if (sym->symbol_list)
error_die(token->pos, "redefinition of %s", show_typename (sym));
sym->pos = *repos;
- token = parse(token->next, sym);
- token = expect(token, '}', "at end of struct-union-enum-specifier");
// Mark the structure as needing re-examination
sym->examined = 0;
- sym->endpos = token->pos;
+ goto end;
}
return token;
}
@@ -764,9 +762,11 @@ static struct token *struct_union_enum_specifier(enum type type,
sym = alloc_symbol(token->pos, type);
set_current_scope(sym); // used by dissect
- token = parse(token->next, sym);
ctx->ctype.base_type = sym;
- token = expect(token, '}', "at end of specifier");
+end:
+ token = parse(token->next, sym);
+ token = expect(token, '}', "at end of specifier");
+
sym->endpos = token->pos;
return token;