diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2018-09-26 09:17:05 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-09-26 09:17:05 +0000 |
commit | 81d85d4baeb6ada71652a556cec1663511c3933c (patch) | |
tree | 79af3198a79338d30d795c9898c973c38f3e8a9b /gcc | |
parent | 05a84157e98dfb25500705c0bc2570139a01075f (diff) | |
download | gcc-81d85d4baeb6ada71652a556cec1663511c3933c.zip gcc-81d85d4baeb6ada71652a556cec1663511c3933c.tar.gz gcc-81d85d4baeb6ada71652a556cec1663511c3933c.tar.bz2 |
[Ada] Fix assertion failure on record subtype with -gnatRj
The JSON output of the -gnatR machinery was choking on record subtypes
and the change fixes this oversight.
The following package must now compile properly with -gnatRj:
package P is
type Rec (D : Integer) is record
C : Integer;
case D is
when 1 =>
S : String (1 .. 20);
when 2 =>
B : Boolean;
when others =>
Ch1 : Character;
F : Float;
Ch2 : Character;
end case;
end record;
subtype Rec1 is Rec (1);
end P;
2018-09-26 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* repinfo.adb (List_Record_Layout): Be prepared for JSON output.
(List_Record_Info): Use the flat representation for record
subtypes in the JSON format.
From-SVN: r264609
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/repinfo.adb | 18 |
2 files changed, 22 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e139e2d..83685b4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-09-26 Eric Botcazou <ebotcazou@adacore.com> + + * repinfo.adb (List_Record_Layout): Be prepared for JSON output. + (List_Record_Info): Use the flat representation for record + subtypes in the JSON format. + 2018-09-26 Justin Squirek <squirek@adacore.com> * lib-writ.adb, lib-writ.ads (Write_With_Lines): Add diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index b2bc9ca..d5c099f 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -1358,7 +1358,8 @@ package body Repinfo is Starting_First_Bit : Uint := Uint_0; Prefix : String := "") is - Comp : Entity_Id; + Comp : Entity_Id; + First : Boolean := True; begin Comp := First_Component_Or_Discriminant (Ent); @@ -1413,6 +1414,15 @@ package body Repinfo is goto Continue; end if; + if List_Representation_Info_To_JSON then + if First then + Write_Eol; + First := False; + else + Write_Line (","); + end if; + end if; + List_Component_Layout (Comp, Starting_Position, Starting_First_Bit, Prefix); end; @@ -1678,7 +1688,11 @@ package body Repinfo is Write_Line (","); Write_Str (" ""record"": ["); - List_Structural_Record_Layout (Ent, Ent); + if Is_Base_Type (Ent) then + List_Structural_Record_Layout (Ent, Ent); + else + List_Record_Layout (Ent); + end if; Write_Eol; Write_Str (" ]"); |