From 2f2df5093b5e02b2cc2ad05894dc3cbb4e6fac0c Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 22 Nov 2025 19:02:38 +0100 Subject: c: make the warning for '()' function declarations less strict --- c/c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/c.c b/c/c.c index 534fba6..b6ca90e 100644 --- a/c/c.c +++ b/c/c.c @@ -2451,7 +2451,7 @@ declarator(struct declstate *st, struct comp *cm, struct span span0) { error(&decl.span, "function cannot return function type '%ty'", decl.ty); else if (decl.ty.t == TYARRAY) error(&decl.span, "function cannot return array type '%ty'", decl.ty); - if (l->kandr && ccopt.cstd > STDC89) + if (l->kandr && ccopt.cstd > STDC89 && (ccopt.cstd >= STDC23 || ccopt.pedant)) 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); -- cgit v1.2.3