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: Ghjuvan Lacambre <lacambre@adacore.com>
Subject: [Ada] Replace use of 'Image with use of Error_Msg_Uint
Date: Wed, 22 Sep 2021 15:15:37 +0000	[thread overview]
Message-ID: <20210922151537.GA1907658@adacore.com> (raw)

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

'Image is too recent for bootstraping and shouldn't be used when
emitting error messages in any case.

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

gcc/ada/

	* sem_case.adb (Composite_Case_Ops): Replace 'Image with
	Error_Msg_Uint.

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

diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb
--- a/gcc/ada/sem_case.adb
+++ b/gcc/ada/sem_case.adb
@@ -1717,12 +1717,12 @@ package body Sem_Case is
                         and then List_Length (Expressions (Expr))
                            /= Nat (Part_Id'Last)
                      then
+                        Error_Msg_Uint_1 := UI_From_Int
+                          (List_Length (Expressions (Expr)));
+                        Error_Msg_Uint_2 := UI_From_Int (Int (Part_Id'Last));
                         Error_Msg_N
-                          ("Array aggregate length"
-                            & List_Length (Expressions (Expr))'Image
-                            & " does not match length of"
-                            & " statically constrained case selector"
-                            & Part_Id'Last'Image, Expr);
+                          ("array aggregate length ^ does not match length " &
+                           "of statically constrained case selector ^", Expr);
                         return;
                      end if;
 
@@ -1761,12 +1761,13 @@ package body Sem_Case is
                         if not Unconstrained_Array_Case
                            and then Strlen /= Nat (Part_Id'Last)
                         then
+                           Error_Msg_Uint_1 := UI_From_Int (Strlen);
+                           Error_Msg_Uint_2 := UI_From_Int
+                             (Int (Part_Id'Last));
                            Error_Msg_N
-                             ("String literal length"
-                              & Strlen'Image
-                              & " does not match length of"
-                              & " statically constrained case selector"
-                              & Part_Id'Last'Image, Expr);
+                             ("String literal length ^ does not match length" &
+                              " of statically constrained case selector ^",
+                              Expr);
                            return;
                         end if;
 



                 reply	other threads:[~2021-09-22 15:15 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=20210922151537.GA1907658@adacore.com \
    --to=derodat@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=lacambre@adacore.com \
    /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).