aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-04-18 11:13:05 +0200
committerlemon <lsof@mailbox.org>2026-04-18 11:13:05 +0200
commit43acc2cd453ba1188e734ee415d9426e2da5ce40 (patch)
tree09986e36ab4bee33506cd05c2d757aea3fe2e77f /src
parent970508c5221f930937021203107ecbac5ac9960c (diff)
c: for undeclared function calls, put implicit decl in toplevel
To avoid repeated warnings
Diffstat (limited to 'src')
-rw-r--r--src/c.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/c.c b/src/c.c
index c449129..c6b6584 100644
--- a/src/c.c
+++ b/src/c.c
@@ -749,7 +749,12 @@ callexpr(CComp *cm, const Span *span_, const Expr *callee)
};
warn(&span, "call to undeclared function '%s'", name);
((Expr *)callee)->ty = decl.ty;
+
+ /* put in the top-level to avoid repeated warnings */
+ Env *save = cm->env;
+ for (Env *e = cm->env; e->up; e = e->up) ;
((Expr *)callee)->decl = putdecl(cm, &decl);
+ cm->env = save;
}
if (!builtin) {