Browse Source

compiler: change RTTI size of record field offset from fixed 32bit to platform dependent integer (sizeint) since it is stored this way in the compiler. This is also Delphi compatible, rtl: adopt rtl appropriately

git-svn-id: trunk@24460 -
paul 12 years ago
parent
commit
fe04dedbab
3 changed files with 7 additions and 3 deletions
  1. 2 2
      compiler/ncgrtti.pas
  2. 4 0
      rtl/inc/rtti.inc
  3. 1 1
      rtl/objpas/typinfo.pp

+ 2 - 2
compiler/ncgrtti.pas

@@ -159,7 +159,7 @@ implementation
             ((rt=fullrtti) or (tobjectdef(def).childof.needs_inittable)) then
           begin
             current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(tobjectdef(def).childof,rt)));
-            current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(0));
+            current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_pint(0));
             inc(fieldcnt);
           end;
         st:=def.symtable;
@@ -175,7 +175,7 @@ implementation
                not is_objc_class_or_protocol(tfieldvarsym(sym).vardef) then
               begin
                 current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(tfieldvarsym(sym).vardef,rt)));
-                current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tfieldvarsym(sym).fieldoffset));
+                current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_pint(tfieldvarsym(sym).fieldoffset));
                 inc(fieldcnt);
               end;
           end;

+ 4 - 0
rtl/inc/rtti.inc

@@ -20,7 +20,11 @@ type
   PRecordElement=^TRecordElement;
   TRecordElement=packed record
     TypeInfo: Pointer;
+    {$ifdef VER2_6}
     Offset: Longint;
+    {$else}
+    Offset: SizeInt;
+    {$endif}
   end;
 
   PRecordInfo=^TRecordInfo;

+ 1 - 1
rtl/objpas/typinfo.pp

@@ -131,7 +131,7 @@ unit typinfo;
       {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
       record
         TypeRef: PTypeInfo;
-        FldOffset: Integer;
+        FldOffset: SizeInt;
       end;
 
 {$PACKRECORDS C}