From e77a66ee9a6049c7a6b0d351772ad61be775c447 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Fri, 24 Feb 2023 00:47:47 +0100 Subject: [PATCH] ada: Add tags to warnings controlled by Warn_On_Redundant_Constructs 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. --- 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 990bace4fbac..6014f71e661e 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 b44708a3e8ca..f1511b70648c 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 876dbacc9515..212c13e12fd1 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.47.2