aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/env.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-11 06:51:48 +0200
committerlemon <lsof@mailbox.org>2022-08-11 06:51:48 +0200
commit25bf34e2c15b93e1cedab14cc83dddbb08ffcf3b (patch)
tree5b57e1d11126a839851ef3038e61a524719b4bfc /bootstrap/env.c
parent99cb50d4f13d587e3a0e0f2a44485f301409afb4 (diff)
more fix
Diffstat (limited to 'bootstrap/env.c')
-rw-r--r--bootstrap/env.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bootstrap/env.c b/bootstrap/env.c
index ec80e62..773550a 100644
--- a/bootstrap/env.c
+++ b/bootstrap/env.c
@@ -33,6 +33,8 @@ envput(struct env *env, const struct decl *decl) {
if ((d0 = envfind(&env_noparent, INT_MAX, decl->name))) {
// modify existing forward declarations?
+ if (decl == d0 || !memcmp(d0, decl, sizeof *d0))
+ return d0;
if (d0->t == Dmacro && !memcmp(&decl->macro, &d0->macro, sizeof decl->macro))
return d0;
if (d0->t == Dtepl && !memcmp(&decl->tepl, &d0->tepl, sizeof decl->tepl))
@@ -52,6 +54,7 @@ envput(struct env *env, const struct decl *decl) {
}
}
if (d0->t == Dfn && d0->externp == decl->externp && d0->fn.selfty == decl->fn.selfty && !d0->fn.body && decl->fn.body) {
+ *(int *)&decl->fn.id = d0->fn.id;
goto ok;
}
if (d0->t == Dfn && d0->externp == decl->externp && d0->fn.selfty == decl->fn.selfty && !d0->fn.body)