[Ada] Fix irregular output with -gnatR3
This fixes a long-standing quirk present in the layout information for record
types displayed by the -gnatR3 switch: when a component has a variable
(starting) position, its corresponding line in the output has an irregular and
awkward format. After this change, the format is the same as in all the other
cases.
For the following record:
type R (m : natural) is record
s : string (1 .. m);
r : natural;
b : boolean;
end record;
for R'alignment use 4;
pragma Pack (R);
the output of -gnatR3 used to be:
for R'Object_Size use
17179869248;
for R'Value_Size use ((#1 + 8) * 8);
for R'Alignment use 4;
for R use record
m at 0 range 0 .. 30;
s at 4 range 0 .. ((#1 * 8)) - 1;
r at bit offset (((#1 + 4) * 8)) size in bits = 31
b at bit offset ((((#1 + 7) * 8) + 7)) size in bits = 1
end record;
and is changed into:
for R'Object_Size use
17179869248;
for R'Value_Size use ((#1 + 8) * 8);
for R'Alignment use 4;
for R use record
m at 0 range 0 .. 30;
s at 4 range 0 .. ((#1 * 8)) - 1;
r at (#1 + 4) range 0 .. 30;
b at (#1 + 7) range 7 .. 7;
end record;
2018-05-24 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* fe.h (Set_Normalized_First_Bit): Declare.
(Set_Normalized_Position): Likewise.
* repinfo.adb (List_Record_Layout): Do not use irregular output for a
variable position. Fix minor spacing issue.
* gcc-interface/decl.c (annotate_rep): If a field has a variable
offset, compute the normalized position and annotate it in addition to
the bit offset.
From-SVN: r260669