From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Piotr Trojanek <trojanek@adacore.com>
Subject: [Ada] Special-case printing of SPARK_Mode in error messages
Date: Mon, 12 Sep 2022 10:19:38 +0200 [thread overview]
Message-ID: <20220912081938.GA1513071@poulhies-Precision-5550> (raw)
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
For error messages with inserted names that include acronyms like SPARK
or CPP, we want to preserve the casing. The list of special-cased named
is currently the same as in gnatpp.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* erroutc.adb (Set_Msg_Insertion_Name): Special-case printing with
acronyms.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1515 bytes --]
diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb
--- a/gcc/ada/erroutc.adb
+++ b/gcc/ada/erroutc.adb
@@ -1317,8 +1317,8 @@ package body Erroutc is
Name_Len := Name_Len - 1;
end if;
- -- If operator name or character literal name, just print it as is
- -- Also print as is if it ends in a right paren (case of x'val(nnn))
+ -- If operator name or character literal name, just print it as is.
+ -- Also print as is if it ends in a right paren (case of x'val(nnn)).
if Name_Buffer (1) = '"'
or else Name_Buffer (1) = '''
@@ -1534,6 +1534,32 @@ package body Erroutc is
elsif Text = "_TYPE_INVARIANT" then
Set_Msg_Str ("TYPE_INVARIANT'CLASS");
+ -- Preserve casing for names that include acronyms
+
+ elsif Text = "Cpp_Class" then
+ Set_Msg_Str ("CPP_Class");
+
+ elsif Text = "Cpp_Constructor" then
+ Set_Msg_Str ("CPP_Constructor");
+
+ elsif Text = "Cpp_Virtual" then
+ Set_Msg_Str ("CPP_Virtual");
+
+ elsif Text = "Cpp_Vtable" then
+ Set_Msg_Str ("CPP_Vtable");
+
+ elsif Text = "Persistent_Bss" then
+ Set_Msg_Str ("Persistent_BSS");
+
+ elsif Text = "Spark_Mode" then
+ Set_Msg_Str ("SPARK_Mode");
+
+ elsif Text = "Use_Vads_Size" then
+ Set_Msg_Str ("Use_VADS_Size");
+
+ elsif Text = "Vads_Size" then
+ Set_Msg_Str ("VADS_size");
+
-- Normal case with no replacement
else
reply other threads:[~2022-09-12 8:19 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=20220912081938.GA1513071@poulhies-Precision-5550 \
--to=poulhies@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=trojanek@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).