mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-07 12:44:39 +01:00
* fix r10544 to take care of packed objects
git-svn-id: trunk@10546 -
This commit is contained in:
parent
1130fb3e95
commit
4b8486e55b
@ -1251,8 +1251,7 @@ implementation
|
|||||||
(def.vmt_offset<fieldoffset) then
|
(def.vmt_offset<fieldoffset) then
|
||||||
begin
|
begin
|
||||||
objst:=tobjectsymtable(def.symtable);
|
objst:=tobjectsymtable(def.symtable);
|
||||||
if objst.recordalignment<sizeof(TConstPtrUInt) then
|
objst.alignrecord(def.vmt_offset,sizeof(TConstPtrUInt));
|
||||||
objst.recordalignment:=sizeof(TConstPtrUInt);
|
|
||||||
for i:=1 to def.vmt_offset-curroffset do
|
for i:=1 to def.vmt_offset-curroffset do
|
||||||
list.concat(tai_const.create_8bit(0));
|
list.concat(tai_const.create_8bit(0));
|
||||||
list.concat(tai_const.createname(def.vmt_mangledname,0));
|
list.concat(tai_const.createname(def.vmt_mangledname,0));
|
||||||
|
|||||||
@ -85,6 +85,7 @@ interface
|
|||||||
constructor create(const n:string;usealign:shortint);
|
constructor create(const n:string;usealign:shortint);
|
||||||
procedure ppuload(ppufile:tcompilerppufile);override;
|
procedure ppuload(ppufile:tcompilerppufile);override;
|
||||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||||
|
procedure alignrecord(fieldoffset,varalign:shortint);
|
||||||
procedure addfield(sym:tfieldvarsym);
|
procedure addfield(sym:tfieldvarsym);
|
||||||
procedure insertfield(sym:tfieldvarsym);
|
procedure insertfield(sym:tfieldvarsym);
|
||||||
procedure addalignmentpadding;
|
procedure addalignmentpadding;
|
||||||
@ -786,11 +787,20 @@ implementation
|
|||||||
result:=1;
|
result:=1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure tabstractrecordsymtable.alignrecord(fieldoffset,varalign:shortint);
|
||||||
|
var
|
||||||
|
varalignrecord: shortint;
|
||||||
|
begin
|
||||||
|
if (usefieldalignment=C_alignment) then
|
||||||
|
varalignrecord:=used_align(varalign,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign)
|
||||||
|
else
|
||||||
|
varalignrecord:=field2recordalignment(fieldoffset,varalign);
|
||||||
|
recordalignment:=max(recordalignment,varalignrecord);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure tabstractrecordsymtable.addfield(sym:tfieldvarsym);
|
procedure tabstractrecordsymtable.addfield(sym:tfieldvarsym);
|
||||||
var
|
var
|
||||||
l : aint;
|
l : aint;
|
||||||
varalignrecord,
|
|
||||||
varalignfield,
|
varalignfield,
|
||||||
varalign : shortint;
|
varalign : shortint;
|
||||||
vardef : tdef;
|
vardef : tdef;
|
||||||
@ -883,11 +893,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=C_alignment) then
|
alignrecord(sym.fieldoffset,varalign);
|
||||||
varalignrecord:=used_align(varalign,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign)
|
|
||||||
else
|
|
||||||
varalignrecord:=field2recordalignment(sym.fieldoffset,varalign);
|
|
||||||
recordalignment:=max(recordalignment,varalignrecord);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user