cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit 46ec9b869105951521341db5d5a75aa55b156601
parent d0f0b0a1006d5398b0d31a1b28e102bed5f4b49b
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 15 May 2019 13:46:07 -0700

decl: Don't emit function if inline is specified without static or extern

This partially addresses #42. Now, no duplicate definitions will be
emitted, but we also don't emit a definition when a later declaration
is specified with extern.

Diffstat:
Mdecl.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/decl.c b/decl.c @@ -944,7 +944,9 @@ decl(struct scope *s, struct func *f) s = mkscope(&filescope); f = mkfunc(name, t, s); stmt(f, s); - emitfunc(f, d->linkage == LINKEXTERN); + /* XXX: need to keep track of function in case a later declaration specifies extern */ + if (!(fs & FUNCINLINE) || sc) + emitfunc(f, d->linkage == LINKEXTERN); s = delscope(s); delfunc(f); d->defined = true;