diff options
author | Michael Forney <mforney@mforney.org> | 2024-04-26 18:07:36 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2024-04-26 18:07:36 -0700 |
commit | 54abcd563ddb7012a7eb19dc1397570f4b6d58a5 (patch) | |
tree | e933835d06e8254abc61ed5dd0d3c986483ad0c9 | |
parent | ccb1421a28d5a76c7c115af2bb8927385f0ee54b (diff) |
decl: Move isnoreturn to struct decl
It is a property of the declaration, not the type.
-rw-r--r-- | cc.h | 3 | ||||
-rw-r--r-- | decl.c | 3 |
2 files changed, 3 insertions, 3 deletions
@@ -215,7 +215,7 @@ struct type { enum typequal ptrqual; } array; struct { - bool isvararg, isnoreturn; + bool isvararg; struct decl *params; size_t nparam; } func; @@ -283,6 +283,7 @@ struct decl { struct { /* the function might have an "inline definition" (C11 6.7.4p7) */ bool inlinedefn; + bool isnoreturn; } func; enum builtinkind builtin; } u; @@ -589,7 +589,6 @@ declaratortypes(struct scope *s, struct list *result, char **name, struct scope t = mktype(TYPEFUNC, 0); t->qual = QUALNONE; t->u.func.isvararg = false; - t->u.func.isnoreturn = false; t->u.func.params = NULL; t->u.func.nparam = 0; paramend = &t->u.func.params; @@ -1051,12 +1050,12 @@ decl(struct scope *s, struct func *f) case DECLFUNC: if (align) error(&tok.loc, "function '%s' declared with alignment specifier", name); - t->u.func.isnoreturn |= fs & FUNCNORETURN; if (f && sc && sc != SCEXTERN) /* 6.7.1p7 */ error(&tok.loc, "function '%s' with block scope may only have storage class 'extern'", name); d = declcommon(s, kind, name, asmname, t, tq, sc, prior); d->value = mkglobal(d); d->u.func.inlinedefn = d->linkage == LINKEXTERN && fs & FUNCINLINE && !(sc & SCEXTERN) && (!prior || prior->u.func.inlinedefn); + d->u.func.isnoreturn = fs & FUNCNORETURN; if (tok.kind == TLBRACE) { if (!allowfunc) error(&tok.loc, "function definition not allowed"); |