* Use RestoreUnitsSyms to avoid wrong hints about unused units

* Avoid hints about unsused units if thet have a init or finalize code
This commit is contained in:
pierre 2000-05-03 14:39:51 +00:00
parent eb59e0b11c
commit d6b3b9a9cd

View File

@ -616,6 +616,7 @@ unit pmodules;
procedure loaddefaultunits; procedure loaddefaultunits;
var var
hp : pmodule; hp : pmodule;
unitsym : punitsym;
begin begin
{ are we compiling the system unit? } { are we compiling the system unit? }
if (cs_compilesystem in aktmoduleswitches) then if (cs_compilesystem in aktmoduleswitches) then
@ -633,7 +634,9 @@ unit pmodules;
symtablestack:=systemunit; symtablestack:=systemunit;
{ add to the used units } { add to the used units }
current_module^.used_units.concat(new(pused_unit,init(hp,true))); current_module^.used_units.concat(new(pused_unit,init(hp,true)));
refsymtable^.insert(new(punitsym,init('SYSTEM',systemunit))); unitsym:=new(punitsym,init('SYSTEM',systemunit));
inc(unitsym^.refs);
refsymtable^.insert(unitsym);
{ read default constant definitions } { read default constant definitions }
make_ref:=false; make_ref:=false;
readconstdefs; readconstdefs;
@ -655,7 +658,9 @@ unit pmodules;
symtablestack:=hp^.globalsymtable; symtablestack:=hp^.globalsymtable;
{ add to the used units } { add to the used units }
current_module^.used_units.concat(new(pused_unit,init(hp,true))); current_module^.used_units.concat(new(pused_unit,init(hp,true)));
refsymtable^.insert(new(punitsym,init('OBJPAS',hp^.globalsymtable))); unitsym:=new(punitsym,init('OBJPAS',hp^.globalsymtable));
inc(unitsym^.refs);
refsymtable^.insert(unitsym);
end; end;
{ Profile unit? Needed for go32v2 only } { Profile unit? Needed for go32v2 only }
if (cs_profile in aktmoduleswitches) and (target_info.target=target_i386_go32v2) then if (cs_profile in aktmoduleswitches) and (target_info.target=target_i386_go32v2) then
@ -665,7 +670,9 @@ unit pmodules;
symtablestack:=hp^.globalsymtable; symtablestack:=hp^.globalsymtable;
{ add to the used units } { add to the used units }
current_module^.used_units.concat(new(pused_unit,init(hp,true))); current_module^.used_units.concat(new(pused_unit,init(hp,true)));
refsymtable^.insert(new(punitsym,init('PROFILE',hp^.globalsymtable))); unitsym:=new(punitsym,init('PROFILE',hp^.globalsymtable));
inc(unitsym^.refs);
refsymtable^.insert(unitsym);
end; end;
{ Units only required for main module } { Units only required for main module }
if not(current_module^.is_unit) then if not(current_module^.is_unit) then
@ -678,7 +685,9 @@ unit pmodules;
symtablestack:=hp^.globalsymtable; symtablestack:=hp^.globalsymtable;
{ add to the used units } { add to the used units }
current_module^.used_units.concat(new(pused_unit,init(hp,true))); current_module^.used_units.concat(new(pused_unit,init(hp,true)));
refsymtable^.insert(new(punitsym,init('HEAPTRC',hp^.globalsymtable))); unitsym:=new(punitsym,init('HEAPTRC',hp^.globalsymtable));
inc(unitsym^.refs);
refsymtable^.insert(unitsym);
end; end;
{ Lineinfo unit } { Lineinfo unit }
if (cs_gdb_lineinfo in aktglobalswitches) then if (cs_gdb_lineinfo in aktglobalswitches) then
@ -688,7 +697,9 @@ unit pmodules;
symtablestack:=hp^.globalsymtable; symtablestack:=hp^.globalsymtable;
{ add to the used units } { add to the used units }
current_module^.used_units.concat(new(pused_unit,init(hp,true))); current_module^.used_units.concat(new(pused_unit,init(hp,true)));
refsymtable^.insert(new(punitsym,init('LINEINFO',hp^.globalsymtable))); unitsym:=new(punitsym,init('LINEINFO',hp^.globalsymtable));
inc(unitsym^.refs);
refsymtable^.insert(unitsym);
end; end;
end; end;
{ save default symtablestack } { save default symtablestack }
@ -704,6 +715,7 @@ unit pmodules;
hp2 : pmodule; hp2 : pmodule;
hp3 : psymtable; hp3 : psymtable;
oldprocsym:Pprocsym; oldprocsym:Pprocsym;
unitsym : punitsym;
begin begin
oldprocsym:=aktprocsym; oldprocsym:=aktprocsym;
consume(_USES); consume(_USES);
@ -734,7 +746,12 @@ unit pmodules;
pused_unit(current_module^.used_units.last)^.in_uses:=true; pused_unit(current_module^.used_units.last)^.in_uses:=true;
if current_module^.compiled then if current_module^.compiled then
exit; exit;
refsymtable^.insert(new(punitsym,init(s,hp2^.globalsymtable))); unitsym:=new(punitsym,init(s,hp2^.globalsymtable));
{ never claim about unused unit if
there is init or finalize code PM }
if (hp2^.flags and (uf_init or uf_finalize))<>0 then
inc(unitsym^.refs);
refsymtable^.insert(unitsym);
end end
else else
Message1(sym_e_duplicate_id,s); Message1(sym_e_duplicate_id,s);
@ -1074,6 +1091,7 @@ unit pmodules;
{ this unit symtable is obsolete } { this unit symtable is obsolete }
{ dispose(unitst,done); { dispose(unitst,done);
disposed as localsymtable !! } disposed as localsymtable !! }
RestoreUnitSyms;
exit; exit;
end; end;
unitst^.symtabletype:=globalsymtable; unitst^.symtabletype:=globalsymtable;
@ -1150,6 +1168,7 @@ unit pmodules;
if current_module^.compiled then if current_module^.compiled then
begin begin
RestoreUnitSyms;
exit; exit;
end; end;
@ -1387,6 +1406,9 @@ unit pmodules;
current_module^.localsymtable:=nil; current_module^.localsymtable:=nil;
end; end;
RestoreUnitSyms;
if is_assembler_generated then if is_assembler_generated then
begin begin
{ finish asmlist by adding segment starts } { finish asmlist by adding segment starts }
@ -1678,7 +1700,11 @@ unit pmodules;
end. end.
{ {
$Log$ $Log$
Revision 1.191 2000-04-27 11:35:03 pierre Revision 1.192 2000-05-03 14:39:51 pierre
* Use RestoreUnitsSyms to avoid wrong hints about unused units
* Avoid hints about unsused units if thet have a init or finalize code
Revision 1.191 2000/04/27 11:35:03 pierre
* power to ** operator fixed * power to ** operator fixed
Revision 1.190 2000/04/26 08:54:18 pierre Revision 1.190 2000/04/26 08:54:18 pierre