2
0
Эх сурвалжийг харах

* do not generate references to the variant type, if the variants feature is not available

git-svn-id: trunk@37660 -
florian 7 жил өмнө
parent
commit
0725bfcdf0

+ 20 - 8
compiler/psystem.pas

@@ -380,8 +380,11 @@ implementation
         openchararraytype:=carraydef.create(0,-1,sizesinttype);
         tarraydef(openchararraytype).elementdef:=cansichartype;
         cfiletype:=cfiledef.createuntyped;
-        cvarianttype:=cvariantdef.create(vt_normalvariant);
-        colevarianttype:=cvariantdef.create(vt_olevariant);
+        if f_variants in features then
+          begin
+            cvarianttype:=cvariantdef.create(vt_normalvariant);
+            colevarianttype:=cvariantdef.create(vt_olevariant);
+          end;
 
 {$ifdef cpufpemu}
         { Normal types }
@@ -469,8 +472,11 @@ implementation
         addtype('WideChar',cwidechartype);
         addtype('Text',cfiledef.createtext);
         addtype('TypedFile',cfiledef.createtyped(voidtype));
-        addtype('Variant',cvarianttype);
-        addtype('OleVariant',colevarianttype);
+        if f_variants in features then
+          begin
+            addtype('Variant',cvarianttype);
+            addtype('OleVariant',colevarianttype);
+          end;
         { Internal types }
         addtype('$undefined',cundefinedtype);
         addtype('$formal',cformaltype);
@@ -530,8 +536,11 @@ implementation
 {$endif x86}
         addtype('$openchararray',openchararraytype);
         addtype('$file',cfiletype);
-        addtype('$variant',cvarianttype);
-        addtype('$olevariant',colevarianttype);
+        if f_variants in features then
+          begin
+            addtype('$variant',cvarianttype);
+            addtype('$olevariant',colevarianttype);
+          end;
         if init_settings.fputype<>fpu_none then
           begin
             addtype('$s32real',s32floattype);
@@ -678,8 +687,11 @@ implementation
             loadtype('vtblarray',vmtarraytype);
             loadtype('__vtbl_ptr_type',vmttype);
           end;
-        loadtype('variant',cvarianttype);
-        loadtype('olevariant',colevarianttype);
+        if f_threading in features then
+          begin
+            loadtype('variant',cvarianttype);
+            loadtype('olevariant',colevarianttype);
+          end;
         loadtype('methodpointer',methodpointertype);
         loadtype('nestedprocpointer',nestedprocpointertype);
         loadtype('HRESULT',hresultdef);

+ 2 - 0
rtl/inc/objpash.inc

@@ -439,7 +439,9 @@
            vtPWideChar     : (VPWideChar: PWideChar);
            vtAnsiString    : (VAnsiString: Pointer);
            vtCurrency      : (VCurrency: PCurrency);
+{$ifdef FPC_HAS_FEATURE_VARIANTS}
            vtVariant       : (VVariant: PVariant);
+{$endif FPC_HAS_FEATURE_VARIANTS}
            vtInterface     : (VInterface: Pointer);
            vtWideString    : (VWideString: Pointer);
            vtInt64         : (VInt64: PInt64);

+ 3 - 0
rtl/inc/systemh.inc

@@ -567,8 +567,11 @@ Type
   PDateTime           = ^TDateTime;
 {$endif}
   PError              = ^TError;
+
+{$ifdef FPC_HAS_FEATURE_VARIANTS}
   PVariant            = ^Variant;
   POleVariant         = ^OleVariant;
+{$endif FPC_HAS_FEATURE_VARIANTS}
 
   PWideChar           = ^WideChar;
   PPWideChar          = ^PWideChar;