From 94987944d44007c40974122c8a45ba02aba06387 Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 22 Dec 2025 18:10:35 +0100 Subject: c: recognize __attribute__ as decltok, improve diagnostic for expected declaration --- c/c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'c/c.c') diff --git a/c/c.c b/c/c.c index 1eaba44..a93dcc6 100644 --- a/c/c.c +++ b/c/c.c @@ -141,6 +141,7 @@ isdecltok(struct comp *cm) kw(int), kw(char), kw(_Bool), kw(bool), kw(struct), kw(union), kw(enum), kw(__typeof__), kw(typeof), kw(typeof_unqual), + kw(__attribute__) #undef kw }; return ((uint)tk.t-TKWBEGIN_) < countof(kws) && kws[tk.t-TKWBEGIN_]; @@ -2338,7 +2339,7 @@ End: goto Bad; st->base = mktype(t ? t : TYINT); } else if (!st->base.t) { - if (ccopt.cstd < STDC23) { + if (ccopt.cstd < STDC23 && peek(cm, NULL) == TKIDENT) { if (ccopt.cstd > STDC89) warn(&tk.span, "type implicitly declared as int"); st->base = mktype(TYINT); -- cgit v1.2.3