aboutsummaryrefslogtreecommitdiff
path: root/decl.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2020-01-30 13:53:18 -0800
committerMichael Forney <mforney@mforney.org>2020-01-30 13:53:18 -0800
commit5b575aa2e3e42085d9087210b41560cf5849c746 (patch)
treeea8cdc078cc02eab821cc22cb099730188944ec1 /decl.c
parent3849dd77204177fce2568b5bbace6e400c6a6064 (diff)
decl: Better check for inline definitions
Diffstat (limited to 'decl.c')
-rw-r--r--decl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/decl.c b/decl.c
index 26e9851..cff7564 100644
--- a/decl.c
+++ b/decl.c
@@ -994,6 +994,7 @@ decl(struct scope *s, struct func *f)
}
}
d = declcommon(s, kind, name, asmname, t, tq, sc, prior);
+ d->inlinedefn = d->linkage == LINKEXTERN && fs & FUNCINLINE && !(sc & SCEXTERN) && (!prior || prior->inlinedefn);
if (tok.kind == TLBRACE) {
if (!allowfunc)
error(&tok.loc, "function definition not allowed");
@@ -1003,7 +1004,7 @@ decl(struct scope *s, struct func *f)
f = mkfunc(d, name, t, s);
stmt(f, s);
/* XXX: need to keep track of function in case a later declaration specifies extern */
- if (!(fs & FUNCINLINE) || sc)
+ if (!d->inlinedefn)
emitfunc(f, d->linkage == LINKEXTERN);
s = delscope(s);
delfunc(f);