* [COMMITTED] ada: Add tags to warnings controlled by Warn_On_Redundant_Constructs
@ 2023-05-23 8:09 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-05-23 8:09 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
From: Piotr Trojanek <trojanek@adacore.com>
Some of the calls to Error_Msg_N controlled by the flag
Warn_On_Redundant_Constructs missed the "?r?" tag in their message
string. This caused a misleading "[enabled by default]" label to appear
next to the error message.
Spotted while adding a warning about duplicated choices in exception
handlers.
gcc/ada/
* freeze.adb (Freeze_Record_Type): Add tag for redundant pragma Pack.
* sem_aggr.adb (Resolve_Record_Aggregate): Add tag for redundant OTHERS
choice.
* sem_ch8.adb (Use_One_Type): Add tag for redundant USE clauses.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/freeze.adb | 2 +-
gcc/ada/sem_aggr.adb | 4 ++--
gcc/ada/sem_ch8.adb | 10 +++++-----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 990bace4fba..6014f71e661 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -5500,7 +5500,7 @@ package body Freeze is
if Warn_On_Redundant_Constructs then
Error_Msg_N -- CODEFIX
- ("??pragma Pack has no effect, no unplaced components",
+ ("?r?pragma Pack has no effect, no unplaced components",
Get_Rep_Pragma (Rec, Name_Pack));
end if;
end if;
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index b44708a3e8c..f1511b70648 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -5834,9 +5834,9 @@ package body Sem_Aggr is
("OTHERS must represent at least one component", Selectr);
elsif Others_Box = 1 and then Warn_On_Redundant_Constructs then
- Error_Msg_N ("OTHERS choice is redundant?", Box_Node);
+ Error_Msg_N ("OTHERS choice is redundant?r?", Box_Node);
Error_Msg_N
- ("\previous choices cover all components?", Box_Node);
+ ("\previous choices cover all components?r?", Box_Node);
end if;
exit Verification;
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 876dbacc951..212c13e12fd 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -10755,7 +10755,7 @@ package body Sem_Ch8 is
Error_Msg_Sloc := Sloc (Clause1);
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use_type_clause #??", Clause2, T);
+ & "use_type_clause #?r?", Clause2, T);
return;
end if;
@@ -10827,7 +10827,7 @@ package body Sem_Ch8 is
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use_type_clause #??", Err_No, Id);
+ & "use_type_clause #?r?", Err_No, Id);
end if;
end Use_Clause_Known;
@@ -10837,7 +10837,7 @@ package body Sem_Ch8 is
else
Error_Msg_NE -- CODEFIX
("& is already use-visible through previous "
- & "use_type_clause??", Id, T);
+ & "use_type_clause?r?", Id, T);
end if;
-- The package where T is declared is already used
@@ -10852,7 +10852,7 @@ package body Sem_Ch8 is
Error_Msg_Sloc :=
Sloc (Find_First_Use (Current_Use_Clause (Scope (T))));
Error_Msg_NE -- CODEFIX
- ("& is already use-visible through package use clause #??",
+ ("& is already use-visible through package use clause #?r?",
Id, T);
end if;
@@ -10861,7 +10861,7 @@ package body Sem_Ch8 is
else
Error_Msg_Node_2 := Scope (T);
Error_Msg_NE -- CODEFIX
- ("& is already use-visible inside package &??", Id, T);
+ ("& is already use-visible inside package &?r?", Id, T);
end if;
end if;
end Use_One_Type;
--
2.40.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-23 8:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-23 8:09 [COMMITTED] ada: Add tags to warnings controlled by Warn_On_Redundant_Constructs Marc Poulhiès
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).