* Use the original unitname when defining a unitsym

This commit is contained in:
peter 2003-04-12 15:13:03 +00:00
parent bd90c192c5
commit aca9555704

View File

@ -513,18 +513,23 @@ implementation
{ Give a warning if objpas is loaded } { Give a warning if objpas is loaded }
if s='OBJPAS' then if s='OBJPAS' then
Message(parser_w_no_objpas_use_mode); Message(parser_w_no_objpas_use_mode);
{ Using the unit itself is not possible }
if (s<>current_module.modulename^) then
begin
{ check if the unit is already used } { check if the unit is already used }
hp2:=nil;
pu:=tused_unit(current_module.used_units.first); pu:=tused_unit(current_module.used_units.first);
while assigned(pu) do while assigned(pu) do
begin begin
if (pu.u.modulename^=s) then if (pu.u.modulename^=s) then
begin
hp2:=pu.u;
break; break;
end;
pu:=tused_unit(pu.next); pu:=tused_unit(pu.next);
end; end;
{ avoid uses of itself } { Need to register the unit? }
if not assigned(pu) and (s<>current_module.modulename^) then if not assigned(hp2) then
begin
{ register the unit }
hp2:=registerunit(current_module,sorg,fn); hp2:=registerunit(current_module,sorg,fn);
{ the current module uses the unit hp2 } { the current module uses the unit hp2 }
current_module.addusedunit(hp2,true); current_module.addusedunit(hp2,true);
@ -559,7 +564,11 @@ implementation
pu.interface_checksum:=pu.u.interface_crc; pu.interface_checksum:=pu.u.interface_crc;
{ Create unitsym, we need to use the name as specified, we { Create unitsym, we need to use the name as specified, we
can not use the modulename because that can be different can not use the modulename because that can be different
when -Un is used } when -Un is used. But when the names are the same then
force the name of the module so there will be no difference
in the case of the name }
if upper(sorg)=pu.u.modulename^ then
sorg:=pu.u.realmodulename^;
unitsym:=tunitsym.create(sorg,pu.u.globalsymtable); unitsym:=tunitsym.create(sorg,pu.u.globalsymtable);
if (pu.u.flags and (uf_init or uf_finalize))<>0 then if (pu.u.flags and (uf_init or uf_finalize))<>0 then
inc(unitsym.refs); inc(unitsym.refs);
@ -1444,7 +1453,10 @@ So, all parameters are passerd into registers in sparc architecture.}
end. end.
{ {
$Log$ $Log$
Revision 1.99 2003-03-23 23:21:42 hajny Revision 1.100 2003-04-12 15:13:03 peter
* Use the original unitname when defining a unitsym
Revision 1.99 2003/03/23 23:21:42 hajny
+ emx target added + emx target added
Revision 1.98 2003/03/17 22:20:08 peter Revision 1.98 2003/03/17 22:20:08 peter