mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 12:26:58 +02:00
* fixed writing "packed" status of bitpacked records to ppu files.
Not sure how it ever worked, nor how exactly symtable ppu entries work -- but it's now stored with the recorddef (which also means that bitpacking is disabled currently for objects and classes, since they are based on tabstractrecorddef rather than trecorddef) git-svn-id: trunk@4679 -
This commit is contained in:
parent
6be389e954
commit
3bb41dcf9a
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -6532,6 +6532,8 @@ tests/webtbf/tw6686.pp svneol=native#text/plain
|
||||
tests/webtbf/tw6796.pp svneol=native#text/plain
|
||||
tests/webtbf/tw6922.pp svneol=native#text/plain
|
||||
tests/webtbf/tw6970.pp svneol=native#text/plain
|
||||
tests/webtbf/tw7438.pp svneol=native#text/plain
|
||||
tests/webtbf/tw7438a.pp svneol=native#text/plain
|
||||
tests/webtbf/uw0744.pp svneol=native#text/plain
|
||||
tests/webtbf/uw0840a.pp svneol=native#text/plain
|
||||
tests/webtbf/uw0840b.pp svneol=native#text/plain
|
||||
|
@ -43,7 +43,7 @@ type
|
||||
{$endif Test_Double_checksum}
|
||||
|
||||
const
|
||||
CurrentPPUVersion=64;
|
||||
CurrentPPUVersion=65;
|
||||
|
||||
{ buffer sizes }
|
||||
maxentrysize = 1024;
|
||||
|
@ -711,7 +711,8 @@ implementation
|
||||
else
|
||||
begin
|
||||
oldaktpackrecords:=aktpackrecords;
|
||||
if not bitpacking then
|
||||
if (not bitpacking) or
|
||||
(token in [_CLASS,_OBJECT]) then
|
||||
aktpackrecords:=1
|
||||
else
|
||||
aktpackrecords:=bit_alignment;
|
||||
|
@ -2809,6 +2809,7 @@ implementation
|
||||
trecordsymtable(symtable).fieldalignment:=shortint(ppufile.getbyte);
|
||||
trecordsymtable(symtable).recordalignment:=shortint(ppufile.getbyte);
|
||||
trecordsymtable(symtable).padalignment:=shortint(ppufile.getbyte);
|
||||
trecordsymtable(symtable).usefieldalignment:=shortint(ppufile.getbyte);
|
||||
trecordsymtable(symtable).ppuload(ppufile);
|
||||
symtable.defowner:=self;
|
||||
isunion:=false;
|
||||
@ -2876,6 +2877,7 @@ implementation
|
||||
ppufile.putbyte(byte(trecordsymtable(symtable).fieldalignment));
|
||||
ppufile.putbyte(byte(trecordsymtable(symtable).recordalignment));
|
||||
ppufile.putbyte(byte(trecordsymtable(symtable).padalignment));
|
||||
ppufile.putbyte(byte(trecordsymtable(symtable).usefieldalignment));
|
||||
ppufile.writeentry(ibrecorddef);
|
||||
trecordsymtable(symtable).ppuwrite(ppufile);
|
||||
end;
|
||||
|
@ -103,7 +103,6 @@ interface
|
||||
{ no need to save in/restore from ppu file. datasize is always (databitsize+7) div 8. }
|
||||
databitsize : aint;
|
||||
{ bitpacked? -> all fieldvarsym offsets are in bits instead of bytes }
|
||||
packed_record: boolean;
|
||||
public
|
||||
property datasize : aint read _datasize write setdatasize;
|
||||
end;
|
||||
@ -831,7 +830,6 @@ implementation
|
||||
databitsize:=0;
|
||||
recordalignment:=1;
|
||||
usefieldalignment:=usealign;
|
||||
packed_record:=usealign=bit_alignment;
|
||||
padalignment:=1;
|
||||
{ recordalign C_alignment means C record packing, that starts
|
||||
with an alignment of 1 }
|
||||
@ -849,8 +847,6 @@ implementation
|
||||
var
|
||||
storesymtable : tsymtable;
|
||||
begin
|
||||
packed_record:=boolean(ppufile.getbyte);
|
||||
|
||||
storesymtable:=aktrecordsymtable;
|
||||
aktrecordsymtable:=self;
|
||||
|
||||
@ -865,8 +861,6 @@ implementation
|
||||
oldtyp : byte;
|
||||
storesymtable : tsymtable;
|
||||
begin
|
||||
ppufile.putbyte(byte(packed_record));
|
||||
|
||||
storesymtable:=aktrecordsymtable;
|
||||
aktrecordsymtable:=self;
|
||||
oldtyp:=ppufile.entrytyp;
|
||||
@ -1059,7 +1053,7 @@ implementation
|
||||
|
||||
function tabstractrecordsymtable.is_packed: boolean;
|
||||
begin
|
||||
result:=packed_record;
|
||||
result:=usefieldalignment=bit_alignment;
|
||||
end;
|
||||
|
||||
|
||||
|
17
tests/webtbf/tw7438.pp
Normal file
17
tests/webtbf/tw7438.pp
Normal file
@ -0,0 +1,17 @@
|
||||
{ %norun }
|
||||
|
||||
{$mode macpas}
|
||||
unit tw7438;
|
||||
|
||||
interface
|
||||
|
||||
type
|
||||
tr = bitpacked record
|
||||
l1: longint;
|
||||
l2: longint;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
12
tests/webtbf/tw7438a.pp
Normal file
12
tests/webtbf/tw7438a.pp
Normal file
@ -0,0 +1,12 @@
|
||||
{ %fail }
|
||||
|
||||
{$mode macpas}
|
||||
|
||||
uses
|
||||
tw7438;
|
||||
|
||||
var
|
||||
t: tr;
|
||||
begin
|
||||
writeln(ptruint(@t.l2) - ptruint(@t.l1));
|
||||
end.
|
Loading…
Reference in New Issue
Block a user