I was looking at TypeInfo (based on 3.2.2rc)
line 632 unit TypInfo
Show quoted text 18 lines
To find out about alignment (for any target which needs alignment), I looked through other code:
fpc_3.2.2\source\tests\webtbs\tw12038.pp
line 194 procedure DisplayDetails(Informations : TPropInfo; const expectedresult: ansistring);
appears to access the data (except for the ParamTypeRefs array) The testcase does not seem to make any adjustments for alignment.
fpc_3.2.2\source\packages\rtl-objpas\src\inc\rtti.pp line 3341 TRttiMethodType.GetParameters also appears to access the same typeinfo.
It makes alignments in 3 different places
ptr := AlignTParamFlags(ptr); // foreach Flags : TParamFlags; in the ParamList
ptr := AlignToPtr(PByte(ptr) + ptr^ + SizeOf(Byte)); // ResultTypeRef paramtypes := PPPTypeInfo(AlignTypeData(ptr)); // ParamTypeRefs
Which is correct?
Or do they access different structures?
----------------------
A few other notes:
FPC_REQUIRES_PROPER_ALIGNMENT
does not seem to be listed on
https://www.freepascal.org/docs-html/prog/progap7.html
TypInfo line 1461
in Procedure GetPropInfos(TypeInfo : PTypeInfo;PropList : PPropList); TP:=aligntoptr(PPropInfo(aligntoptr((Pointer(@TD^.UnitName)+Length(TD^.UnitName)+1)))); Why call aligntoptr twice?
The TypeCast in between does not change the alignment. (all the math is done within the innermost call)
