aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2024-04-15 01:03:20 -0700
committerMichael Forney <mforney@mforney.org>2024-04-15 01:23:32 -0700
commit7ee038a55d70ffb94139869acf423ebe0dd52b70 (patch)
treed0c340567f8a2295b100c6ee6205c66803310c4a
parentfc05a07d20b7c5baf312faaab46247d9057233b1 (diff)
decl: Improve check for function prototype consisting of only 'void'
-rw-r--r--decl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/decl.c b/decl.c
index 1fc57af..40ae579 100644
--- a/decl.c
+++ b/decl.c
@@ -629,8 +629,10 @@ declaratortypes(struct scope *s, struct list *result, char **name, bool allowabs
break;
}
}
- if (t->u.func.params->type->kind == TYPEVOID && !t->u.func.params->next)
+ if (t->u.func.nparam == 1 && !t->u.func.isvararg && t->u.func.params->type->kind == TYPEVOID && !t->u.func.params->name) {
t->u.func.params = NULL;
+ t->u.func.nparam = 0;
+ }
break;
case TRPAREN:
break;