mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 21:11:23 +02:00
* never say that an automatically added unit is unused (mantis #27691)
git-svn-id: trunk@30261 -
This commit is contained in:
parent
636fb64577
commit
ea3a306da8
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14337,6 +14337,7 @@ tests/webtbs/tw2765.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw27658.pp svneol=native#text/pascal
|
tests/webtbs/tw27658.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw27665.pp svneol=native#text/plain
|
tests/webtbs/tw27665.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2767.pp svneol=native#text/plain
|
tests/webtbs/tw2767.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw27691.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2771.pp svneol=native#text/plain
|
tests/webtbs/tw2771.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2772.pp svneol=native#text/plain
|
tests/webtbs/tw2772.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2776.pp svneol=native#text/plain
|
tests/webtbs/tw2776.pp svneol=native#text/plain
|
||||||
|
@ -169,7 +169,7 @@ implementation
|
|||||||
CheckResourcesUsed:=found;
|
CheckResourcesUsed:=found;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure AddUnit(const s:string);
|
procedure AddUnit(const s:string; autoadded: boolean);
|
||||||
var
|
var
|
||||||
hp : tppumodule;
|
hp : tppumodule;
|
||||||
unitsym : tunitsym;
|
unitsym : tunitsym;
|
||||||
@ -189,6 +189,12 @@ implementation
|
|||||||
tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym);
|
tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym);
|
||||||
{ add to used units }
|
{ add to used units }
|
||||||
current_module.addusedunit(hp,false,unitsym);
|
current_module.addusedunit(hp,false,unitsym);
|
||||||
|
{ mark as used if automatically added }
|
||||||
|
if autoadded then
|
||||||
|
begin
|
||||||
|
current_module.updatemaps;
|
||||||
|
inc(current_module.unitmap[hp.moduleid].refs);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -211,7 +217,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
{ Variants unit is not loaded yet, load it now }
|
{ Variants unit is not loaded yet, load it now }
|
||||||
Message(parser_w_implicit_uses_of_variants_unit);
|
Message(parser_w_implicit_uses_of_variants_unit);
|
||||||
AddUnit('variants');
|
AddUnit('variants',true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -292,7 +298,7 @@ implementation
|
|||||||
|
|
||||||
{ insert the system unit, it is allways the first. Load also the
|
{ insert the system unit, it is allways the first. Load also the
|
||||||
internal types from the system unit }
|
internal types from the system unit }
|
||||||
AddUnit('system');
|
AddUnit('system',true);
|
||||||
systemunit:=tglobalsymtable(symtablestack.top);
|
systemunit:=tglobalsymtable(symtablestack.top);
|
||||||
load_intern_types;
|
load_intern_types;
|
||||||
|
|
||||||
@ -306,26 +312,26 @@ implementation
|
|||||||
begin
|
begin
|
||||||
{ Heaptrc unit, load heaptrace before any other units especially objpas }
|
{ Heaptrc unit, load heaptrace before any other units especially objpas }
|
||||||
if (cs_use_heaptrc in current_settings.globalswitches) then
|
if (cs_use_heaptrc in current_settings.globalswitches) then
|
||||||
AddUnit('heaptrc');
|
AddUnit('heaptrc',true);
|
||||||
{ Lineinfo unit }
|
{ Lineinfo unit }
|
||||||
if (cs_use_lineinfo in current_settings.globalswitches) then begin
|
if (cs_use_lineinfo in current_settings.globalswitches) then begin
|
||||||
case paratargetdbg of
|
case paratargetdbg of
|
||||||
dbg_stabs:
|
dbg_stabs:
|
||||||
AddUnit('lineinfo');
|
AddUnit('lineinfo',true);
|
||||||
dbg_stabx:
|
dbg_stabx:
|
||||||
AddUnit('lnfogdb');
|
AddUnit('lnfogdb',true);
|
||||||
else
|
else
|
||||||
AddUnit('lnfodwrf');
|
AddUnit('lnfodwrf',true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{ Valgrind requires c memory manager }
|
{ Valgrind requires c memory manager }
|
||||||
if (cs_gdb_valgrind in current_settings.globalswitches) then
|
if (cs_gdb_valgrind in current_settings.globalswitches) then
|
||||||
AddUnit('cmem');
|
AddUnit('cmem',true);
|
||||||
{$ifdef cpufpemu}
|
{$ifdef cpufpemu}
|
||||||
{ Floating point emulation unit?
|
{ Floating point emulation unit?
|
||||||
softfpu must be in the system unit anyways (FK)
|
softfpu must be in the system unit anyways (FK)
|
||||||
if (cs_fp_emulation in current_settings.moduleswitches) and not(target_info.system in system_wince) then
|
if (cs_fp_emulation in current_settings.moduleswitches) and not(target_info.system in system_wince) then
|
||||||
AddUnit('softfpu');
|
AddUnit('softfpu',true);
|
||||||
}
|
}
|
||||||
{$endif cpufpemu}
|
{$endif cpufpemu}
|
||||||
{ Which kind of resource support?
|
{ Which kind of resource support?
|
||||||
@ -333,55 +339,55 @@ implementation
|
|||||||
otherwise we need it here since it must be loaded quite early }
|
otherwise we need it here since it must be loaded quite early }
|
||||||
if (tf_has_winlike_resources in target_info.flags) then
|
if (tf_has_winlike_resources in target_info.flags) then
|
||||||
if target_res.id=res_ext then
|
if target_res.id=res_ext then
|
||||||
AddUnit('fpextres')
|
AddUnit('fpextres',true)
|
||||||
else
|
else
|
||||||
AddUnit('fpintres');
|
AddUnit('fpintres',true);
|
||||||
end;
|
end;
|
||||||
{ Objpas unit? }
|
{ Objpas unit? }
|
||||||
if m_objpas in current_settings.modeswitches then
|
if m_objpas in current_settings.modeswitches then
|
||||||
AddUnit('objpas');
|
AddUnit('objpas',true);
|
||||||
|
|
||||||
{ Macpas unit? }
|
{ Macpas unit? }
|
||||||
if m_mac in current_settings.modeswitches then
|
if m_mac in current_settings.modeswitches then
|
||||||
AddUnit('macpas');
|
AddUnit('macpas',true);
|
||||||
|
|
||||||
if m_iso in current_settings.modeswitches then
|
if m_iso in current_settings.modeswitches then
|
||||||
AddUnit('iso7185');
|
AddUnit('iso7185',true);
|
||||||
|
|
||||||
{ blocks support? }
|
{ blocks support? }
|
||||||
if m_blocks in current_settings.modeswitches then
|
if m_blocks in current_settings.modeswitches then
|
||||||
AddUnit('blockrtl');
|
AddUnit('blockrtl',true);
|
||||||
|
|
||||||
{ default char=widechar? }
|
{ default char=widechar? }
|
||||||
if m_default_unicodestring in current_settings.modeswitches then
|
if m_default_unicodestring in current_settings.modeswitches then
|
||||||
AddUnit('uuchar');
|
AddUnit('uuchar',true);
|
||||||
|
|
||||||
{ Objective-C support unit? }
|
{ Objective-C support unit? }
|
||||||
if (m_objectivec1 in current_settings.modeswitches) then
|
if (m_objectivec1 in current_settings.modeswitches) then
|
||||||
begin
|
begin
|
||||||
{ interface to Objective-C run time }
|
{ interface to Objective-C run time }
|
||||||
AddUnit('objc');
|
AddUnit('objc',true);
|
||||||
loadobjctypes;
|
loadobjctypes;
|
||||||
{ NSObject }
|
{ NSObject }
|
||||||
if not(current_module.is_unit) or
|
if not(current_module.is_unit) or
|
||||||
(current_module.modulename^<>'OBJCBASE') then
|
(current_module.modulename^<>'OBJCBASE') then
|
||||||
AddUnit('objcbase');
|
AddUnit('objcbase',true);
|
||||||
end;
|
end;
|
||||||
{ Profile unit? Needed for go32v2 only }
|
{ Profile unit? Needed for go32v2 only }
|
||||||
if (cs_profile in current_settings.moduleswitches) and
|
if (cs_profile in current_settings.moduleswitches) and
|
||||||
(target_info.system in [system_i386_go32v2,system_i386_watcom]) then
|
(target_info.system in [system_i386_go32v2,system_i386_watcom]) then
|
||||||
AddUnit('profile');
|
AddUnit('profile',true);
|
||||||
if (cs_load_fpcylix_unit in current_settings.globalswitches) then
|
if (cs_load_fpcylix_unit in current_settings.globalswitches) then
|
||||||
begin
|
begin
|
||||||
AddUnit('fpcylix');
|
AddUnit('fpcylix',true);
|
||||||
AddUnit('dynlibs');
|
AddUnit('dynlibs',true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ CPU targets with microcontroller support can add a controller specific unit }
|
{ CPU targets with microcontroller support can add a controller specific unit }
|
||||||
if ControllerSupport and (target_info.system in systems_embedded) and
|
if ControllerSupport and (target_info.system in systems_embedded) and
|
||||||
(current_settings.controllertype<>ct_none) and
|
(current_settings.controllertype<>ct_none) and
|
||||||
(embedded_controllers[current_settings.controllertype].controllerunitstr<>'') then
|
(embedded_controllers[current_settings.controllertype].controllerunitstr<>'') then
|
||||||
AddUnit(embedded_controllers[current_settings.controllertype].controllerunitstr);
|
AddUnit(embedded_controllers[current_settings.controllertype].controllerunitstr,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -394,7 +400,7 @@ implementation
|
|||||||
s:=GetToken(hs,',');
|
s:=GetToken(hs,',');
|
||||||
if s='' then
|
if s='' then
|
||||||
break;
|
break;
|
||||||
AddUnit(s);
|
AddUnit(s,true);
|
||||||
until false;
|
until false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1701,7 +1707,7 @@ type
|
|||||||
module_name:=module_name+'.'+orgpattern;
|
module_name:=module_name+'.'+orgpattern;
|
||||||
consume(_ID);
|
consume(_ID);
|
||||||
end;
|
end;
|
||||||
AddUnit(module_name);
|
AddUnit(module_name,false);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
consume(_ID);
|
consume(_ID);
|
||||||
@ -2259,7 +2265,7 @@ type
|
|||||||
if target_info.system in systems_internal_sysinit then
|
if target_info.system in systems_internal_sysinit then
|
||||||
begin
|
begin
|
||||||
{ add start/halt unit }
|
{ add start/halt unit }
|
||||||
AddUnit(linker.sysinitunit);
|
AddUnit(linker.sysinitunit,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef arm}
|
{$ifdef arm}
|
||||||
|
6
tests/webtbs/tw27691.pp
Normal file
6
tests/webtbs/tw27691.pp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{ %opt=-Seh -vh }
|
||||||
|
|
||||||
|
{$modeswitch unicodestrings}
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user