aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-09-14 10:12:43 +0200
committerlemon <lsof@mailbox.org>2025-09-14 10:12:43 +0200
commit519522449252389f265dc8db40d833a0a5770b5d (patch)
tree5e298caf16a84d840107967d75bf93e5622e19fd
parent959ba83bf55edbb72cd3a4f4a3edf3fab2ea613f (diff)
frontend: warn k&r function declaration
-rw-r--r--c.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/c.c b/c.c
index d4fb280..d059cda 100644
--- a/c.c
+++ b/c.c
@@ -2117,6 +2117,8 @@ declarator(struct declstate *st, struct comp *cm) {
error(&decl.span, "function cannot return array type", decl.ty);
else if (decl.ty.t != TYVOID && isincomplete(decl.ty))
error(&decl.span, "function cannot return incomplete type (%ty)", decl.ty);
+ if (l->kandr && ccopt.cstd > STDC89)
+ warn(&l->span, "function declaration without a prototype is deprecated");
decl.ty = mkfntype(decl.ty, l->npar, l->param, l->pqual, l->kandr, l->variadic);
if (l->param != declparamtmp) free(l->param);
if (l->pqual != declpqualtmp) free(l->pqual);