diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index ac2a8a3eb0..4b20a5111c 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -1486,8 +1486,7 @@ unit pmodules; { test static symtable } if (Errorcount=0) then begin - { st^.allsymbolsused; - already done in compile_proc_body ! } + st^.allsymbolsused; st^.allprivatesused; end; @@ -1551,7 +1550,10 @@ unit pmodules; end. { $Log$ - Revision 1.169 1999-11-20 01:19:10 pierre + Revision 1.170 1999-11-22 00:23:09 pierre + * also complain about unused functions in program + + Revision 1.169 1999/11/20 01:19:10 pierre * DLL index used for win32 target with DEF file + DLL initialization/finalization support diff --git a/compiler/psub.pas b/compiler/psub.pas index bcd7e0e48a..adbf3609f9 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -1601,8 +1601,9 @@ begin begin { not for unit init, becuase the var can be used in finalize, it will be done in proc_unit } - if not(aktprocsym^.definition^.proctypeoption in [potype_unitinit,potype_unitfinalize]) then - aktprocsym^.definition^.localst^.allsymbolsused; + if not(aktprocsym^.definition^.proctypeoption + in [potype_proginit,potype_unitinit,potype_unitfinalize]) then + aktprocsym^.definition^.localst^.allsymbolsused; aktprocsym^.definition^.parast^.allsymbolsused; end; end; @@ -1937,7 +1938,10 @@ end. { $Log$ - Revision 1.35 1999-11-17 17:05:02 pierre + Revision 1.36 1999-11-22 00:23:09 pierre + * also complain about unused functions in program + + Revision 1.35 1999/11/17 17:05:02 pierre * Notes/hints changes Revision 1.34 1999/11/10 00:24:02 pierre diff --git a/compiler/symtable.pas b/compiler/symtable.pas index 7c33a7e138..77c500235d 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -922,7 +922,11 @@ implementation MessagePos2(psym(p)^.fileinfo,sym_n_private_method_not_used,psym(p)^.owner^.name^,p^.name) { units references are problematic } else if (psym(p)^.refs=0) and not(psym(p)^.typ in [funcretsym,enumsym,unitsym]) then - if (psym(p)^.typ<>procsym) or not (pprocsym(p)^.is_global) then + if (psym(p)^.typ<>procsym) or not (pprocsym(p)^.is_global) or + { all program functions are declared global + but unused should still be signaled PM } + ((psym(p)^.owner^.symtabletype=staticsymtable) and + not current_module^.is_unit) then MessagePos2(psym(p)^.fileinfo,sym_h_local_symbol_not_used,SymTypeName[psym(p)^.typ],p^.name); end; end; @@ -2562,7 +2566,10 @@ implementation end. { $Log$ - Revision 1.65 1999-11-19 14:49:15 pierre + Revision 1.66 1999-11-22 00:23:09 pierre + * also complain about unused functions in program + + Revision 1.65 1999/11/19 14:49:15 pierre * avoid certain wrong notes/hints Revision 1.64 1999/11/18 15:34:48 pierre