aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-06-05 14:45:23 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-16 05:17:59 -0400
commitc7641c228af7c53b5f2ab5ef047f1e36f6a6f3c5 (patch)
treed73fe22866c97a5b6120b15931175b8c813464ec /gcc
parentd9206abba7e6ac0328cafb3f3556c17220101024 (diff)
downloadgcc-c7641c228af7c53b5f2ab5ef047f1e36f6a6f3c5.zip
gcc-c7641c228af7c53b5f2ab5ef047f1e36f6a6f3c5.tar.gz
gcc-c7641c228af7c53b5f2ab5ef047f1e36f6a6f3c5.tar.bz2
[Ada] Spurious redundant use clause warning
gcc/ada/ * sem_ch8.adb (Note_Redundant_Use): Add missing warning tag. Do not check for redundant use clauses in predefined units to avoid misleading warnings that may occur as part of a rtsfind load.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch8.adb15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index f23db52..695ff73 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -9461,9 +9461,14 @@ package body Sem_Ch8 is
Set_Redundant_Use (Clause, True);
+ -- Do not check for redundant use if clause is generated, or in an
+ -- instance, or in a predefined unit to avoid misleading warnings
+ -- that may occur as part of a rtsfind load.
+
if not Comes_From_Source (Clause)
or else In_Instance
or else not Warn_On_Redundant_Constructs
+ or else Is_Predefined_Unit (Current_Sem_Unit)
then
return;
end if;
@@ -9596,10 +9601,12 @@ package body Sem_Ch8 is
Private_Declarations (Parent (Decl))
then
declare
- Par : constant Entity_Id := Defining_Entity (Parent (Decl));
- Spec : constant Node_Id :=
- Specification (Unit (Cunit (Current_Sem_Unit)));
+ Par : constant Entity_Id :=
+ Defining_Entity (Parent (Decl));
+ Spec : constant Node_Id :=
+ Specification (Unit (Cunit (Current_Sem_Unit)));
Cur_List : constant List_Id := List_Containing (Cur_Use);
+
begin
if Is_Compilation_Unit (Par)
and then Par /= Cunit_Entity (Current_Sem_Unit)
@@ -9641,7 +9648,7 @@ package body Sem_Ch8 is
Error_Msg_Sloc := Sloc (Prev_Use);
Error_Msg_NE -- CODEFIX
- ("& is already use-visible through previous use_clause #??",
+ ("& is already use-visible through previous use_clause #?r?",
Redundant, Pack_Name);
end if;
end Note_Redundant_Use;