aboutsummaryrefslogtreecommitdiffhomepage
path: root/c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-11-15 20:10:31 +0100
committerlemon <lsof@mailbox.org>2025-11-15 20:10:31 +0100
commit09aad0efecdc4dea8a09b16976ec9639a6f97655 (patch)
treef20bddcca40b9a370e80d62c9ff26d7837b58736 /c
parent2ca9a54daaa0a955dabf38862cd777be359252e0 (diff)
c: disallow void arguments
Diffstat (limited to 'c')
-rw-r--r--c/c.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/c/c.c b/c/c.c
index fc6bcc0..d2d842d 100644
--- a/c/c.c
+++ b/c/c.c
@@ -684,7 +684,9 @@ callexpr(struct comp *cm, const struct span *span_, const struct expr *callee)
error(&arg.span, "too many args to function taking %d params", td->nmemb);
printsig = 1;
}
- if (td && args.n < td->nmemb && !td->kandr) {
+ if (arg.ty.t == TYVOID) {
+ error(&arg.span, "invalid use of void expression");
+ } else if (td && args.n < td->nmemb && !td->kandr) {
if (!assigncheck(td->param[args.n], &arg)) {
error(&arg.span, "arg #%d of type '%ty' is incompatible with '%ty'",
args.n+1, arg.ty, td->param[args.n]);