mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-19 19:19:32 +01: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,
|
verbose,comphook,ppu,
|
||||||
scanner,switches,
|
scanner,switches,
|
||||||
fmodule,
|
fmodule,
|
||||||
symtable,
|
symconst,symtable,
|
||||||
rabase;
|
rabase;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -788,9 +788,9 @@ implementation
|
|||||||
if not(c in ['0'..'9']) then
|
if not(c in ['0'..'9']) then
|
||||||
begin
|
begin
|
||||||
hs:=current_scanner.readid;
|
hs:=current_scanner.readid;
|
||||||
{ C has the special recordalignmax of -1 }
|
{ C has the special recordalignmax of C_alignment }
|
||||||
if (hs='C') then
|
if (hs='C') then
|
||||||
aktpackrecords:=-1
|
aktpackrecords:=C_alignment
|
||||||
else
|
else
|
||||||
if (hs='NORMAL') or (hs='DEFAULT') then
|
if (hs='NORMAL') or (hs='DEFAULT') then
|
||||||
aktpackrecords:=0
|
aktpackrecords:=0
|
||||||
|
|||||||
@ -30,6 +30,8 @@ uses
|
|||||||
const
|
const
|
||||||
def_alignment = 4;
|
def_alignment = 4;
|
||||||
|
|
||||||
|
C_alignment = -1;
|
||||||
|
|
||||||
{ if you change one of the following contants, }
|
{ if you change one of the following contants, }
|
||||||
{ you have also to change the typinfo unit}
|
{ you have also to change the typinfo unit}
|
||||||
{ and the rtl/i386,template/rttip.inc files }
|
{ and the rtl/i386,template/rttip.inc files }
|
||||||
|
|||||||
@ -82,7 +82,7 @@ interface
|
|||||||
tabstractrecordsymtable = class(tstoredsymtable)
|
tabstractrecordsymtable = class(tstoredsymtable)
|
||||||
public
|
public
|
||||||
datasize : aint;
|
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 }
|
recordalignment, { alignment required when inserting this record }
|
||||||
fieldalignment, { alignment current alignment used when fields are inserted }
|
fieldalignment, { alignment current alignment used when fields are inserted }
|
||||||
padalignment : shortint; { size to a multiple of which the symtable has to be rounded up }
|
padalignment : shortint; { size to a multiple of which the symtable has to be rounded up }
|
||||||
@ -821,9 +821,9 @@ implementation
|
|||||||
recordalignment:=1;
|
recordalignment:=1;
|
||||||
usefieldalignment:=usealign;
|
usefieldalignment:=usealign;
|
||||||
padalignment:=1;
|
padalignment:=1;
|
||||||
{ recordalign -1 means C record packing, that starts
|
{ recordalign C_alignment means C record packing, that starts
|
||||||
with an alignment of 1 }
|
with an alignment of 1 }
|
||||||
if usealign=-1 then
|
if usealign=C_alignment then
|
||||||
fieldalignment:=1
|
fieldalignment:=1
|
||||||
else
|
else
|
||||||
fieldalignment:=usealign;
|
fieldalignment:=usealign;
|
||||||
@ -918,7 +918,7 @@ implementation
|
|||||||
vardef:=sym.vartype.def;
|
vardef:=sym.vartype.def;
|
||||||
varalign:=vardef.alignment;
|
varalign:=vardef.alignment;
|
||||||
{ Calc the alignment size for C style records }
|
{ Calc the alignment size for C style records }
|
||||||
if (usefieldalignment=-1) then
|
if (usefieldalignment=C_alignment) then
|
||||||
begin
|
begin
|
||||||
if (varalign>4) and
|
if (varalign>4) and
|
||||||
((varalign mod 4)<>0) and
|
((varalign mod 4)<>0) and
|
||||||
@ -956,7 +956,7 @@ implementation
|
|||||||
else
|
else
|
||||||
datasize:=sym.fieldoffset+l;
|
datasize:=sym.fieldoffset+l;
|
||||||
{ Calc alignment needed for this record }
|
{ Calc alignment needed for this record }
|
||||||
if (usefieldalignment=-1) then
|
if (usefieldalignment=C_alignment) then
|
||||||
varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
|
varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
|
||||||
else
|
else
|
||||||
if (usefieldalignment=0) then
|
if (usefieldalignment=0) then
|
||||||
@ -984,7 +984,7 @@ implementation
|
|||||||
use the fieldalignment, because that is updated with the
|
use the fieldalignment, because that is updated with the
|
||||||
used alignment. }
|
used alignment. }
|
||||||
if (padalignment = 1) then
|
if (padalignment = 1) then
|
||||||
if usefieldalignment=-1 then
|
if usefieldalignment=C_alignment then
|
||||||
padalignment:=fieldalignment
|
padalignment:=fieldalignment
|
||||||
else
|
else
|
||||||
padalignment:=recordalignment;
|
padalignment:=recordalignment;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user