Browse Source

- Reverted r25269 and commented out r25261. The former one is wrong because it changes unit initialization order. The latter one causes RTL build failures on some targets, needs testing and likely RTL/makefiles patching.

git-svn-id: trunk@25271 -
sergei 12 years ago
parent
commit
d11ec8ac47
2 changed files with 12 additions and 10 deletions
  1. 4 1
      compiler/pdecsub.pas
  2. 8 9
      compiler/pmodules.pas

+ 4 - 1
compiler/pdecsub.pas

@@ -1078,10 +1078,13 @@ implementation
               end;
               end;
             single_type(pd.returndef,[stoAllowSpecialization]);
             single_type(pd.returndef,[stoAllowSpecialization]);
 
 
+// Issue #24863, commented out for now because it breaks building of RTL and needs extensive
+// testing and/or RTL patching.
+{
             if ((pd.returndef=cvarianttype) or (pd.returndef=colevarianttype)) and
             if ((pd.returndef=cvarianttype) or (pd.returndef=colevarianttype)) and
                not(cs_compilesystem in current_settings.moduleswitches) then
                not(cs_compilesystem in current_settings.moduleswitches) then
               current_module.flags:=current_module.flags or uf_uses_variants;
               current_module.flags:=current_module.flags or uf_uses_variants;
-
+}
             if is_dispinterface(pd.struct) and not is_automatable(pd.returndef) then
             if is_dispinterface(pd.struct) and not is_automatable(pd.returndef) then
               Message1(type_e_not_automatable,pd.returndef.typename);
               Message1(type_e_not_automatable,pd.returndef.typename);
 
 

+ 8 - 9
compiler/pmodules.pas

@@ -195,24 +195,20 @@ implementation
     procedure maybeloadvariantsunit;
     procedure maybeloadvariantsunit;
       var
       var
         hp : tmodule;
         hp : tmodule;
-        load : boolean;
       begin
       begin
-        { Must not be called for units }
-        if current_module.is_unit then
-          InternalError(2013081601);
+        { Do we need the variants unit? Skip this
+          for VarUtils unit for bootstrapping }
+        if (current_module.flags and uf_uses_variants=0) or
+           (current_module.modulename^='VARUTILS') then
+          exit;
         { Variants unit already loaded? }
         { Variants unit already loaded? }
-        load:=(current_module.flags and uf_uses_variants)<>0;
         hp:=tmodule(loaded_units.first);
         hp:=tmodule(loaded_units.first);
         while assigned(hp) do
         while assigned(hp) do
           begin
           begin
             if hp.modulename^='VARIANTS' then
             if hp.modulename^='VARIANTS' then
               exit;
               exit;
-            if (hp.flags and uf_uses_variants)<>0 then
-              load:=true;
             hp:=tmodule(hp.next);
             hp:=tmodule(hp.next);
           end;
           end;
-        if (not load) then
-          exit;
         { 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');
@@ -1162,6 +1158,9 @@ type
          { if an Objective-C module, generate rtti and module info }
          { if an Objective-C module, generate rtti and module info }
          MaybeGenerateObjectiveCImageInfo(current_module.globalsymtable,current_module.localsymtable);
          MaybeGenerateObjectiveCImageInfo(current_module.globalsymtable,current_module.localsymtable);
 
 
+         { do we need to add the variants unit? }
+         maybeloadvariantsunit;
+
          { generate rtti/init tables }
          { generate rtti/init tables }
          write_persistent_type_info(current_module.globalsymtable,true);
          write_persistent_type_info(current_module.globalsymtable,true);
          write_persistent_type_info(current_module.localsymtable,false);
          write_persistent_type_info(current_module.localsymtable,false);