2842 struct symbol *decl;
2843 struct decl_state ctx = { .ident = &ident };
2844 struct ctype saved;
2845 struct symbol *base_type;
2846 unsigned long mod;
2847 int is_typedef;
2848
2849 if (match_ident(token, &_Pragma_ident))
2850 return parse_underscore_Pragma(token);
2851
2852 /* Top-level inline asm or static assertion? */
2853 if (token_type(token) == TOKEN_IDENT) {
2854 struct symbol *s = lookup_keyword(token->ident, NS_KEYWORD);
2855 if (s && s->op->toplevel)
2856 return s->op->toplevel(token, list);
2857 }
2858
2859 /* Parse declaration-specifiers, if any */
2860 token = declaration_specifiers(token, &ctx);
2861 mod = storage_modifiers(&ctx);
2862 decl = alloc_symbol(token->pos, SYM_NODE);
2863 /* Just a type declaration? */
2864 if (match_op(token, ';')) {
2865 apply_modifiers(token->pos, &ctx);
2866 return token->next;
2867 }
2868
2869 saved = ctx.ctype;
2870 token = declarator(token, &ctx);
2871 token = handle_attributes(token, &ctx, KW_ATTRIBUTE | KW_ASM);
2872 apply_modifiers(token->pos, &ctx);
2873
2874 decl->ctype = ctx.ctype;
2875 decl->ctype.modifiers |= mod;
2876 decl->endpos = token->pos;
2877
2878 /* Just a type declaration? */
2879 if (!ident) {
2880 warning(token->pos, "missing identifier in declaration");
2881 return expect(token, ';', "at the end of type declaration");
|
2842 struct symbol *decl;
2843 struct decl_state ctx = { .ident = &ident };
2844 struct ctype saved;
2845 struct symbol *base_type;
2846 unsigned long mod;
2847 int is_typedef;
2848
2849 if (match_ident(token, &_Pragma_ident))
2850 return parse_underscore_Pragma(token);
2851
2852 /* Top-level inline asm or static assertion? */
2853 if (token_type(token) == TOKEN_IDENT) {
2854 struct symbol *s = lookup_keyword(token->ident, NS_KEYWORD);
2855 if (s && s->op->toplevel)
2856 return s->op->toplevel(token, list);
2857 }
2858
2859 /* Parse declaration-specifiers, if any */
2860 token = declaration_specifiers(token, &ctx);
2861 mod = storage_modifiers(&ctx);
2862 mod |= ctx.ctype.modifiers & MOD_NORETURN;
2863 decl = alloc_symbol(token->pos, SYM_NODE);
2864 /* Just a type declaration? */
2865 if (match_op(token, ';')) {
2866 apply_modifiers(token->pos, &ctx);
2867 return token->next;
2868 }
2869
2870 saved = ctx.ctype;
2871 token = declarator(token, &ctx);
2872 token = handle_attributes(token, &ctx, KW_ATTRIBUTE | KW_ASM);
2873 apply_modifiers(token->pos, &ctx);
2874
2875 decl->ctype = ctx.ctype;
2876 decl->ctype.modifiers |= mod;
2877 decl->endpos = token->pos;
2878
2879 /* Just a type declaration? */
2880 if (!ident) {
2881 warning(token->pos, "missing identifier in declaration");
2882 return expect(token, ';', "at the end of type declaration");
|