aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/repinfo.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-05-24 13:07:06 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-24 13:07:06 +0000
commit63a329f81c83b58694571cebb39c3ab8cec935c4 (patch)
treec8c829990917f139bff567e4f480f1376d74a210 /gcc/ada/repinfo.adb
parent736e16efea25ff2bb1a0fe230b6a242b8cd5dd0d (diff)
downloadgcc-63a329f81c83b58694571cebb39c3ab8cec935c4.zip
gcc-63a329f81c83b58694571cebb39c3ab8cec935c4.tar.gz
gcc-63a329f81c83b58694571cebb39c3ab8cec935c4.tar.bz2
[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
Diffstat (limited to 'gcc/ada/repinfo.adb')
-rw-r--r--gcc/ada/repinfo.adb24
1 files changed, 1 insertions, 23 deletions
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index 7f7152d..fd7a931 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -992,7 +992,6 @@ package body Repinfo is
declare
Ctyp : constant Entity_Id := Underlying_Type (Etype (Comp));
Esiz : constant Uint := Esize (Comp);
- Bofs : constant Uint := Component_Bit_Offset (Comp);
Npos : constant Uint := Normalized_Position (Comp);
Fbit : constant Uint := Normalized_First_Bit (Comp);
Spos : Uint;
@@ -1047,35 +1046,14 @@ package body Repinfo is
Spaces (Max_Spos_Length - UI_Image_Length);
Write_Str (UI_Image_Buffer (1 .. UI_Image_Length));
- elsif Known_Component_Bit_Offset (Comp)
- and then List_Representation_Info = 3
- then
- Spaces (Max_Spos_Length - 2);
- Write_Str ("bit offset ");
-
- if Starting_Position /= Uint_0
- or else Starting_First_Bit /= Uint_0
- then
- UI_Write (Starting_Position * SSU + Starting_First_Bit);
- Write_Str (" + ");
- end if;
-
- Write_Val (Bofs, Paren => True);
- Write_Str (" size in bits = ");
- Write_Val (Esiz, Paren => True);
- Write_Eol;
-
- goto Continue;
-
elsif Known_Normalized_Position (Comp)
and then List_Representation_Info = 3
then
Spaces (Max_Spos_Length - 2);
if Starting_Position /= Uint_0 then
- Write_Char (' ');
UI_Write (Starting_Position);
- Write_Str (" +");
+ Write_Str (" + ");
end if;
Write_Val (Npos);