* fixed alignment of tfiledef (same as corresponding file recorddef)

* cap set alignment to sizeof(aint)

git-svn-id: trunk@40442 -
This commit is contained in:
Jonas Maebe 2018-12-01 23:07:05 +00:00
parent b84e02b0a9
commit 95d79296bd
2 changed files with 24 additions and 1 deletions

View File

@ -43,7 +43,7 @@ type
{$endif Test_Double_checksum}
const
CurrentPPUVersion = 204;
CurrentPPUVersion = 205;
{ unit flags }
uf_init = $000001; { unit has initialization section }

View File

@ -158,6 +158,7 @@ interface
function getmangledparaname:TSymStr;override;
function size:asizeint;override;
procedure setsize;
function alignment: shortint; override;
end;
tfiledefclass = class of tfiledef;
@ -956,6 +957,7 @@ interface
procedure deref;override;
function GetTypeName:string;override;
function is_publishable : boolean;override;
function alignment: shortint; override;
end;
tsetdefclass = class of tsetdef;
@ -3212,6 +3214,20 @@ implementation
end;
function tfiledef.alignment: shortint;
begin
case filetyp of
ft_text:
result:=search_system_type('TEXTREC').typedef.alignment;
ft_typed,
ft_untyped:
result:=search_system_type('FILEREC').typedef.alignment;
else
internalerror(2018120101);
end;
end;
procedure tfiledef.ppuwrite(ppufile:tcompilerppufile);
begin
inherited ppuwrite(ppufile);
@ -3665,6 +3681,13 @@ implementation
is_publishable:=savesize in [1,2,4];
end;
function tsetdef.alignment: shortint;
begin
Result:=inherited;
if result>sizeof(aint) then
result:=sizeof(aint);
end;
function tsetdef.GetTypeName : string;
begin