public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [Ada] Minor tweak to -gnatR output
Date: Tue, 23 Jul 2019 08:13:00 -0000	[thread overview]
Message-ID: <20190723081350.GA95272@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

This makes sure that the numbers present in the -gnatR output are
printed in decimal format in all cases, since the hexadecimal format is
not compatible with the JSON syntax.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-07-23  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* repinfo.adb (List_Component_Layout): Pass Decimal to UI_Write.
	(Write_Val): Likewise.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1684 bytes --]

--- gcc/ada/repinfo.adb
+++ gcc/ada/repinfo.adb
@@ -1150,7 +1150,7 @@ package body Repinfo is
             if Ekind (Ent) = E_Discriminant then
                Spaces (Indent);
                Write_Str ("      ""discriminant"": ");
-               UI_Write (Discriminant_Number (Ent));
+               UI_Write (Discriminant_Number (Ent), Decimal);
                Write_Line (",");
             end if;
             Spaces (Indent);
@@ -1181,7 +1181,7 @@ package body Repinfo is
             Spaces (Max_Spos_Length - 2);
 
             if Starting_Position /= Uint_0 then
-               UI_Write (Starting_Position);
+               UI_Write (Starting_Position, Decimal);
                Write_Str (" + ");
             end if;
 
@@ -1205,7 +1205,7 @@ package body Repinfo is
             Sbit := Sbit - SSU;
          end if;
 
-         UI_Write (Sbit);
+         UI_Write (Sbit, Decimal);
 
          if List_Representation_Info_To_JSON then
             Write_Line (", ");
@@ -1227,13 +1227,13 @@ package body Repinfo is
             Lbit := Sbit + Esiz - 1;
 
             if List_Representation_Info_To_JSON then
-               UI_Write (Esiz);
+               UI_Write (Esiz, Decimal);
             else
                if Lbit >= 0 and then Lbit < 10 then
                   Write_Char (' ');
                end if;
 
-               UI_Write (Lbit);
+               UI_Write (Lbit, Decimal);
             end if;
 
          --  The test for Esize (Ent) not Uint_0 here is an annoying special
@@ -2414,7 +2414,7 @@ package body Repinfo is
          end if;
 
       else
-         UI_Write (Val);
+         UI_Write (Val, Decimal);
       end if;
    end Write_Val;
 


                 reply	other threads:[~2019-07-23  8:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190723081350.GA95272@adacore.com \
    --to=derodat@adacore.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).