diff options
author | Yannick Moy <moy@adacore.com> | 2023-07-18 16:52:26 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-08-01 10:06:44 +0200 |
commit | f9b03ef769578fe9388c32b9364f21d0dc1fb6fa (patch) | |
tree | 15757fd127cec6d43544681edcf6174527ac9d19 /gcc/ada | |
parent | 62d8dae02728b8a991ee04133732016e2906233e (diff) | |
download | gcc-f9b03ef769578fe9388c32b9364f21d0dc1fb6fa.zip gcc-f9b03ef769578fe9388c32b9364f21d0dc1fb6fa.tar.gz gcc-f9b03ef769578fe9388c32b9364f21d0dc1fb6fa.tar.bz2 |
ada: Fix generation of JSON output for data representation
Using -gnatRj to generate data representation in JSON format could
lead to an ill-formed output or an assertion failure. Now fixed.
gcc/ada/
* repinfo.adb (List_Common_Type_Info): Fix output when alignment
is not statically known, and fix assertion when expansion is not
enabled.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/repinfo.adb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index 6a30bc7..ba4b32b 100644 --- a/gcc/ada/repinfo.adb +++ b/gcc/ada/repinfo.adb @@ -428,12 +428,21 @@ package body Repinfo is end if; -- Alignment is not always set for task, protected, and class-wide - -- types. Representation aspects are not computed for types in a - -- generic unit. + -- types, or when doing semantic analysis only. Representation aspects + -- are not computed for types in a generic unit. else + -- Add unknown alignment entry in JSON format to ensure the format is + -- valid, as a comma is added by the caller before another field. + + if List_Representation_Info_To_JSON then + Write_Str (" ""Alignment"": "); + Write_Unknown_Val; + end if; + pragma Assert - (Is_Concurrent_Type (Ent) or else + (not Expander_Active or else + Is_Concurrent_Type (Ent) or else Is_Class_Wide_Type (Ent) or else Sem_Util.In_Generic_Scope (Ent)); end if; |