]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix printing of numbers in JSON output for data representation
authorYannick Moy <moy@adacore.com>
Wed, 19 Jul 2023 15:57:30 +0000 (17:57 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 1 Aug 2023 08:06:46 +0000 (10:06 +0200)
When calling GNAT with -gnatRj to generate JSON output for the
data representation of types and objects, it could happen that
numbers are printed in the Ada syntax for hexadecimal numbers, which
leads to an invalid JSON file being generated. Now fixed both for
the JSON output and the Ada-like output.

gcc/ada/

* repinfo.adb (Compute_Max_Length): Set parameter to print number
in decimal notation.
(List_Component_Layout): Same.

gcc/ada/repinfo.adb

index ba4b32b7027ec53520b0aac602be5d494181ede7..ecd35e94e142280d59a963638631fe4431717082 100644 (file)
@@ -1100,7 +1100,7 @@ package body Repinfo is
                      goto Continue;
                   end if;
 
-                  UI_Image (Spos);
+                  UI_Image (Spos, Format => Decimal);
                else
                   --  If the record is not packed, then we know that all fields
                   --  whose position is not specified have starting normalized
@@ -1176,7 +1176,7 @@ package body Repinfo is
                Spos := Spos + 1;
             end if;
 
-            UI_Image (Spos);
+            UI_Image (Spos, Format => Decimal);
             Spaces (Max_Spos_Length - UI_Image_Length);
             Write_Str (UI_Image_Buffer (1 .. UI_Image_Length));