diff options
| author | 2025-12-22 18:10:35 +0100 | |
|---|---|---|
| committer | 2025-12-22 18:10:35 +0100 | |
| commit | 94987944d44007c40974122c8a45ba02aba06387 (patch) | |
| tree | 9d584cc4f3e6a6c61207b2781e3dc4eca514eaff | |
| parent | 2dc09d20d6107588dd418ff802f866207fb0fa10 (diff) | |
c: recognize __attribute__ as decltok, improve diagnostic for expected declaration
| -rw-r--r-- | c/c.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |