diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-01 14:50:19 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:03:26 -0700 |
| commit | 4250a6355c2a29764f5a8b31a1a22087439068dd (patch) | |
| tree | 6e93c596e3ab8c98d0a44e7189a85d14c248a689 | |
| parent | dec7c920ee3318080de6d1b739fdb3e29d6059e4 (diff) | |
| download | sparse-dev-4250a6355c2a29764f5a8b31a1a22087439068dd.tar.gz | |
Be more lenient in placement of 'asm("reg")' variable hard-register
specifiers.
They now parse the same way as __attribute__ node-specifiers. This
simplifies the code, and makes sparse not care about random gcc
rules for exactly where one or the other can be placed.
| -rw-r--r-- | parse.c | 30 |
1 files changed, 17 insertions, 13 deletions
@@ -711,10 +711,23 @@ static struct token *declarator(struct token *token, struct symbol **tree, struc static struct token *handle_attributes(struct token *token, struct ctype *ctype) { - while (match_idents(token, &__attribute___ident, &__attribute_ident, NULL)) { - struct ctype thistype = { 0, }; - token = attribute_specifier(token->next, &thistype); - apply_ctype(token->pos, &thistype, ctype); + for (;;) { + if (token_type(token) != TOKEN_IDENT) + break; + if (match_idents(token, &__attribute___ident, &__attribute_ident, NULL)) { + struct ctype thistype = { 0, }; + token = attribute_specifier(token->next, &thistype); + apply_ctype(token->pos, &thistype, ctype); + continue; + } + if (match_idents(token, &asm_ident, &__asm_ident, &__asm___ident)) { + struct expression *expr; + token = expect(token->next, '(', "after asm"); + token = parse_expression(token->next, &expr); + token = expect(token, ')', "after asm"); + continue; + } + break; } return token; } @@ -1628,15 +1641,6 @@ static struct token *external_declaration(struct token *token, struct symbol_lis } for (;;) { - if (token_type(token) == TOKEN_IDENT) { - if (token->ident == &asm_ident || token->ident == &__asm_ident || token->ident == &__asm___ident) { - struct expression *expr; - - token = expect(token->next, '(', "after asm"); - token = parse_expression(token->next, &expr); - token = expect(token, ')', "after asm"); - } - } if (!is_typedef && match_op(token, '=')) { if (decl->ctype.modifiers & MOD_EXTERN) { warning(decl->pos, "symbol with external linkage has initializer"); |
