* different, simpler fix for #27691 fixed in r30261; should fix the

internalerrors on some platforms after that revision

git-svn-id: trunk@30265 -
This commit is contained in:
Jonas Maebe 2015-03-20 14:23:28 +00:00
parent 57212decc8
commit 39594adae1
2 changed files with 26 additions and 31 deletions

View File

@ -983,6 +983,7 @@ implementation
{ Give a note when the unit is not referenced, skip { Give a note when the unit is not referenced, skip
this is for units with an initialization/finalization } this is for units with an initialization/finalization }
if (unitmap[pu.u.moduleid].refs=0) and if (unitmap[pu.u.moduleid].refs=0) and
pu.in_uses and
((pu.u.flags and (uf_init or uf_finalize))=0) then ((pu.u.flags and (uf_init or uf_finalize))=0) then
CGMessagePos2(pu.unitsym.fileinfo,sym_n_unit_not_used,pu.u.realmodulename^,realmodulename^); CGMessagePos2(pu.unitsym.fileinfo,sym_n_unit_not_used,pu.u.realmodulename^,realmodulename^);
end; end;

View File

@ -169,7 +169,7 @@ implementation
CheckResourcesUsed:=found; CheckResourcesUsed:=found;
end; end;
procedure AddUnit(const s:string; autoadded: boolean); procedure AddUnit(const s:string);
var var
hp : tppumodule; hp : tppumodule;
unitsym : tunitsym; unitsym : tunitsym;
@ -189,12 +189,6 @@ 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;
@ -217,7 +211,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',true); AddUnit('variants');
end; end;
@ -298,7 +292,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',true); AddUnit('system');
systemunit:=tglobalsymtable(symtablestack.top); systemunit:=tglobalsymtable(symtablestack.top);
load_intern_types; load_intern_types;
@ -312,26 +306,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',true); AddUnit('heaptrc');
{ 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',true); AddUnit('lineinfo');
dbg_stabx: dbg_stabx:
AddUnit('lnfogdb',true); AddUnit('lnfogdb');
else else
AddUnit('lnfodwrf',true); AddUnit('lnfodwrf');
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',true); AddUnit('cmem');
{$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',true); AddUnit('softfpu');
} }
{$endif cpufpemu} {$endif cpufpemu}
{ Which kind of resource support? { Which kind of resource support?
@ -339,55 +333,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',true) AddUnit('fpextres')
else else
AddUnit('fpintres',true); AddUnit('fpintres');
end; end;
{ Objpas unit? } { Objpas unit? }
if m_objpas in current_settings.modeswitches then if m_objpas in current_settings.modeswitches then
AddUnit('objpas',true); AddUnit('objpas');
{ Macpas unit? } { Macpas unit? }
if m_mac in current_settings.modeswitches then if m_mac in current_settings.modeswitches then
AddUnit('macpas',true); AddUnit('macpas');
if m_iso in current_settings.modeswitches then if m_iso in current_settings.modeswitches then
AddUnit('iso7185',true); AddUnit('iso7185');
{ blocks support? } { blocks support? }
if m_blocks in current_settings.modeswitches then if m_blocks in current_settings.modeswitches then
AddUnit('blockrtl',true); AddUnit('blockrtl');
{ 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',true); AddUnit('uuchar');
{ 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',true); AddUnit('objc');
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',true); AddUnit('objcbase');
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',true); AddUnit('profile');
if (cs_load_fpcylix_unit in current_settings.globalswitches) then if (cs_load_fpcylix_unit in current_settings.globalswitches) then
begin begin
AddUnit('fpcylix',true); AddUnit('fpcylix');
AddUnit('dynlibs',true); AddUnit('dynlibs');
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,true); AddUnit(embedded_controllers[current_settings.controllertype].controllerunitstr);
end; end;
@ -400,7 +394,7 @@ implementation
s:=GetToken(hs,','); s:=GetToken(hs,',');
if s='' then if s='' then
break; break;
AddUnit(s,true); AddUnit(s);
until false; until false;
end; end;
@ -1707,7 +1701,7 @@ type
module_name:=module_name+'.'+orgpattern; module_name:=module_name+'.'+orgpattern;
consume(_ID); consume(_ID);
end; end;
AddUnit(module_name,false); AddUnit(module_name);
end end
else else
consume(_ID); consume(_ID);
@ -2265,7 +2259,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,true); AddUnit(linker.sysinitunit);
end; end;
{$ifdef arm} {$ifdef arm}