Browse Source

* use constant called C_alignment instead of -1 to denote C-style
packrecords

git-svn-id: trunk@4477 -

Jonas Maebe 19 năm trước cách đây
mục cha
commit
441d5a3c12
3 tập tin đã thay đổi với 11 bổ sung9 xóa
  1. 3 3
      compiler/scandir.pas
  2. 2 0
      compiler/symconst.pas
  3. 6 6
      compiler/symtable.pas

+ 3 - 3
compiler/scandir.pas

@@ -36,7 +36,7 @@ implementation
       verbose,comphook,ppu,
       scanner,switches,
       fmodule,
-      symtable,
+      symconst,symtable,
       rabase;
 
     const
@@ -788,9 +788,9 @@ implementation
         if not(c in ['0'..'9']) then
          begin
            hs:=current_scanner.readid;
-           { C has the special recordalignmax of -1 }
+           { C has the special recordalignmax of C_alignment }
            if (hs='C') then
-            aktpackrecords:=-1
+            aktpackrecords:=C_alignment
            else
             if (hs='NORMAL') or (hs='DEFAULT') then
              aktpackrecords:=0

+ 2 - 0
compiler/symconst.pas

@@ -30,6 +30,8 @@ uses
 const
   def_alignment = 4;
 
+  C_alignment = -1;
+
   { if you change one of the following contants, }
   { you have also to change the typinfo unit}
   { and the rtl/i386,template/rttip.inc files    }

+ 6 - 6
compiler/symtable.pas

@@ -82,7 +82,7 @@ interface
        tabstractrecordsymtable = class(tstoredsymtable)
        public
           datasize       : aint;
-          usefieldalignment,     { alignment to use for fields (PACKRECORDS value), -1 is C style }
+          usefieldalignment,     { alignment to use for fields (PACKRECORDS value), C_alignment is C style }
           recordalignment,       { alignment required when inserting this record }
           fieldalignment,        { alignment current alignment used when fields are inserted }
           padalignment : shortint;   { size to a multiple of which the symtable has to be rounded up }
@@ -821,9 +821,9 @@ implementation
         recordalignment:=1;
         usefieldalignment:=usealign;
         padalignment:=1;
-        { recordalign -1 means C record packing, that starts
+        { recordalign C_alignment means C record packing, that starts
           with an alignment of 1 }
-        if usealign=-1 then
+        if usealign=C_alignment then
           fieldalignment:=1
         else
           fieldalignment:=usealign;
@@ -918,7 +918,7 @@ implementation
         vardef:=sym.vartype.def;
         varalign:=vardef.alignment;
         { Calc the alignment size for C style records }
-        if (usefieldalignment=-1) then
+        if (usefieldalignment=C_alignment) then
           begin
             if (varalign>4) and
               ((varalign mod 4)<>0) and
@@ -956,7 +956,7 @@ implementation
         else
           datasize:=sym.fieldoffset+l;
         { Calc alignment needed for this record }
-        if (usefieldalignment=-1) then
+        if (usefieldalignment=C_alignment) then
           varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
         else
           if (usefieldalignment=0) then
@@ -984,7 +984,7 @@ implementation
           use the fieldalignment, because that is updated with the
           used alignment. }
         if (padalignment = 1) then
-          if usefieldalignment=-1 then
+          if usefieldalignment=C_alignment then
             padalignment:=fieldalignment
           else
             padalignment:=recordalignment;