Przeglądaj źródła

* also complain about unused functions in program

pierre 26 lat temu
rodzic
commit
fca8adf6c2
3 zmienionych plików z 21 dodań i 8 usunięć
  1. 5 3
      compiler/pmodules.pas
  2. 7 3
      compiler/psub.pas
  3. 9 2
      compiler/symtable.pas

+ 5 - 3
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
 

+ 7 - 3
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

+ 9 - 2
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