From 036fd4f4c830d86329f3c67e673ec2aaeb259b98 Mon Sep 17 00:00:00 2001 From: Zeex Date: Sat, 2 Jul 2016 11:03:19 +0600 Subject: [PATCH] Don't set uWRITTEN flag for functions referenced from #emit uWRITTEN == uRETVALUE, so marking a function symbol as written causes a false "should return a value" warning. Fixes #97 --- source/compiler/sc2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index 739ab45..db9f420 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -1330,11 +1330,15 @@ static int command(void) stgwrite("."); stgwrite(sym->name); } /* if */ + /* mark function as "used" */ + /* do NOT mark it as written as that has a different meaning for + * functions (marks them as "should return a value") */ + markusage(sym,uREAD); } else { outval(sym->addr,FALSE); + /* mark symbol as "used", unknown whether for read or write */ + markusage(sym,uREAD | uWRITTEN); } /* if */ - /* mark symbol as "used", unknown whether for read or write */ - markusage(sym,uREAD | uWRITTEN); code_idx+=opargs(1); } /* if */ break;