From 519522449252389f265dc8db40d833a0a5770b5d Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 14 Sep 2025 10:12:43 +0200 Subject: frontend: warn k&r function declaration --- c.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- cgit v1.2.3