From 54abcd563ddb7012a7eb19dc1397570f4b6d58a5 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Fri, 26 Apr 2024 18:07:36 -0700 Subject: decl: Move isnoreturn to struct decl It is a property of the declaration, not the type. --- cc.h | 3 ++- decl.c | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cc.h b/cc.h index 3f4a026..1cd1b32 100644 --- a/cc.h +++ b/cc.h @@ -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; diff --git a/decl.c b/decl.c index 0d53926..0749017 100644 --- a/decl.c +++ b/decl.c @@ -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"); -- cgit v1.2.3