mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 10:09:21 +02:00
* use constant called C_alignment instead of -1 to denote C-style
packrecords git-svn-id: trunk@4477 -
This commit is contained in:
parent
5660a9e875
commit
441d5a3c12
@ -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
|
||||
|
@ -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 }
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user