mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 13:10:34 +02:00
* fix checking for forwards in static symtable
This commit is contained in:
parent
b3225df663
commit
d4dcaeafaf
@ -1016,7 +1016,7 @@ implementation
|
||||
{ Parse the implementation section }
|
||||
if (m_mac in aktmodeswitches) and try_to_consume(_END) then
|
||||
has_impl:= false
|
||||
else
|
||||
else
|
||||
begin
|
||||
consume(_IMPLEMENTATION);
|
||||
has_impl:= true;
|
||||
@ -1118,9 +1118,6 @@ implementation
|
||||
{ the last char should always be a point }
|
||||
consume(_POINT);
|
||||
|
||||
{ generate a list of threadvars }
|
||||
InsertThreadvars;
|
||||
|
||||
{ Generate resoucestrings }
|
||||
If ResourceStrings.ResStrCount>0 then
|
||||
begin
|
||||
@ -1131,18 +1128,6 @@ implementation
|
||||
ResourceStrings.WriteResourceFile(ForceExtension(current_module.ppufilename^,'.rst'));
|
||||
end;
|
||||
|
||||
if (Errorcount=0) then
|
||||
begin
|
||||
{ test static symtable }
|
||||
tstoredsymtable(st).allsymbolsused;
|
||||
tstoredsymtable(st).allprivatesused;
|
||||
current_module.allunitsused;
|
||||
end;
|
||||
|
||||
{$ifdef GDB}
|
||||
write_gdb_info;
|
||||
{$endif GDB}
|
||||
|
||||
if (Errorcount=0) then
|
||||
begin
|
||||
{ tests, if all (interface) forwards are resolved }
|
||||
@ -1151,6 +1136,16 @@ implementation
|
||||
tstoredsymtable(symtablestack).allprivatesused;
|
||||
{ remove cross unit overloads }
|
||||
tstoredsymtable(symtablestack).unchain_overloaded;
|
||||
|
||||
{ test static symtable }
|
||||
tstoredsymtable(st).allsymbolsused;
|
||||
tstoredsymtable(st).allprivatesused;
|
||||
tstoredsymtable(st).check_forwards;
|
||||
tstoredsymtable(st).checklabels;
|
||||
tstoredsymtable(st).unchain_overloaded;
|
||||
|
||||
{ used units }
|
||||
current_module.allunitsused;
|
||||
end;
|
||||
|
||||
{ leave when we got an error }
|
||||
@ -1161,6 +1156,14 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
|
||||
{ generate debuginfo }
|
||||
{$ifdef GDB}
|
||||
write_gdb_info;
|
||||
{$endif GDB}
|
||||
|
||||
{ generate a list of threadvars }
|
||||
InsertThreadvars;
|
||||
|
||||
{ generate imports }
|
||||
if current_module.uses_imports then
|
||||
importlib.generatelib;
|
||||
@ -1388,26 +1391,30 @@ implementation
|
||||
{ consume the last point }
|
||||
consume(_POINT);
|
||||
|
||||
{$ifdef GDB}
|
||||
write_gdb_info;
|
||||
{$endif GDB}
|
||||
|
||||
{ leave when we got an error }
|
||||
if (Errorcount>0) and not status.skip_error then
|
||||
begin
|
||||
Message1(unit_f_errors_in_unit,tostr(Errorcount));
|
||||
status.skip_error:=true;
|
||||
exit;
|
||||
end;
|
||||
|
||||
if (Errorcount=0) then
|
||||
begin
|
||||
{ test static symtable }
|
||||
tstoredsymtable(st).allsymbolsused;
|
||||
tstoredsymtable(st).allprivatesused;
|
||||
tstoredsymtable(st).check_forwards;
|
||||
tstoredsymtable(st).checklabels;
|
||||
tstoredsymtable(st).unchain_overloaded;
|
||||
current_module.allunitsused;
|
||||
end;
|
||||
|
||||
{ leave when we got an error }
|
||||
if (Errorcount>0) and not status.skip_error then
|
||||
begin
|
||||
Message1(unit_f_errors_in_unit,tostr(Errorcount));
|
||||
status.skip_error:=true;
|
||||
exit;
|
||||
end;
|
||||
|
||||
{ generate debuginfo }
|
||||
{$ifdef GDB}
|
||||
write_gdb_info;
|
||||
{$endif GDB}
|
||||
|
||||
{ generate a list of threadvars }
|
||||
InsertThreadvars;
|
||||
|
||||
@ -1473,7 +1480,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.151 2004-05-11 18:22:16 olle
|
||||
Revision 1.152 2004-05-16 13:29:21 peter
|
||||
* fix checking for forwards in static symtable
|
||||
|
||||
Revision 1.151 2004/05/11 18:22:16 olle
|
||||
* changed $mode mac to $mode macpas (macro defined should be FPC_MACPAS)
|
||||
|
||||
Revision 1.150 2004/05/03 09:55:27 olle
|
||||
|
@ -959,39 +959,38 @@ implementation
|
||||
exitswitches:=aktlocalswitches;
|
||||
exitpos:=last_endtoken_filepos;
|
||||
|
||||
{ the procedure is now defined }
|
||||
procdef.forwarddef:=false;
|
||||
|
||||
{ Check for unused labels, forwards, symbols for procedures. Static
|
||||
symtable is checked in pmodules }
|
||||
if (Errorcount=0) and
|
||||
(tstoredsymtable(procdef.localst).symtabletype<>staticsymtable) then
|
||||
begin
|
||||
{ check if forwards are resolved }
|
||||
tstoredsymtable(procdef.localst).check_forwards;
|
||||
{ check if all labels are used }
|
||||
tstoredsymtable(procdef.localst).checklabels;
|
||||
{ remove cross unit overloads }
|
||||
tstoredsymtable(procdef.localst).unchain_overloaded;
|
||||
{ check for unused symbols, but only if there is no asm block }
|
||||
if not(pi_uses_asm in flags) then
|
||||
begin
|
||||
tstoredsymtable(procdef.localst).allsymbolsused;
|
||||
tstoredsymtable(procdef.parast).allsymbolsused;
|
||||
end;
|
||||
end;
|
||||
|
||||
if assigned(code) then
|
||||
begin
|
||||
{ get a better entry point }
|
||||
entrypos:=code.fileinfo;
|
||||
|
||||
{ the procedure is now defined }
|
||||
procdef.forwarddef:=false;
|
||||
|
||||
if (Errorcount=0) then
|
||||
begin
|
||||
{ add implicit entry and exit code }
|
||||
add_entry_exit_code;
|
||||
{ check if forwards are resolved }
|
||||
tstoredsymtable(procdef.localst).check_forwards;
|
||||
{ check if all labels are used }
|
||||
tstoredsymtable(procdef.localst).checklabels;
|
||||
{ remove cross unit overloads }
|
||||
tstoredsymtable(procdef.localst).unchain_overloaded;
|
||||
end;
|
||||
|
||||
{ check for unused symbols, but only if there is no asm block }
|
||||
if not(pi_uses_asm in flags) then
|
||||
begin
|
||||
{ not for unit init, becuase the var can be used in finalize,
|
||||
it will be done in proc_unit }
|
||||
if not(procdef.proctypeoption in [potype_proginit,potype_unitinit,potype_unitfinalize]) then
|
||||
tstoredsymtable(procdef.localst).allsymbolsused;
|
||||
tstoredsymtable(procdef.parast).allsymbolsused;
|
||||
end;
|
||||
{ add implicit entry and exit code }
|
||||
add_entry_exit_code;
|
||||
|
||||
{ Finish type checking pass }
|
||||
do_resulttypepass(code);
|
||||
|
||||
end;
|
||||
|
||||
{ store a copy of the original tree for inline, for
|
||||
@ -1346,7 +1345,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.187 2004-04-11 12:37:30 peter
|
||||
Revision 1.188 2004-05-16 13:29:21 peter
|
||||
* fix checking for forwards in static symtable
|
||||
|
||||
Revision 1.187 2004/04/11 12:37:30 peter
|
||||
* fix tree printing
|
||||
|
||||
Revision 1.186 2004/02/19 17:07:42 florian
|
||||
|
Loading…
Reference in New Issue
Block a user