diff options
author | Justin Squirek <squirek@adacore.com> | 2020-01-17 09:10:43 -0500 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-03 06:01:48 -0400 |
commit | 48b185bd015b72e43736e79887afe31296ae5fe2 (patch) | |
tree | c86ba028a29b8e84e198380e8c374567754445ca /gcc/ada/sem_ch10.adb | |
parent | dca8f39d62c4e9d54016a5f86c09906408b58e4e (diff) | |
download | gcc-48b185bd015b72e43736e79887afe31296ae5fe2.zip gcc-48b185bd015b72e43736e79887afe31296ae5fe2.tar.gz gcc-48b185bd015b72e43736e79887afe31296ae5fe2.tar.bz2 |
[Ada] Spurious ineffective with clause warnings on use type clause
2020-06-03 Justin Squirek <squirek@adacore.com>
gcc/ada/
* sem_ch10.adb (Process_Body_Clauses): Add loop to interate
through all prefixes in a use_type clause so that all packages
in the expanded name get examined for effectiveness.
Diffstat (limited to 'gcc/ada/sem_ch10.adb')
-rw-r--r-- | gcc/ada/sem_ch10.adb | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index b0f1ed3..944abfe 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -320,7 +320,6 @@ package body Sem_Ch10 is Nam_Ent : constant Entity_Id := Entity (Name (Clause)); Cont_Item : Node_Id; Prag_Unit : Node_Id; - Subt_Mark : Node_Id; Use_Item : Node_Id; function Same_Unit (N : Node_Id; P : Entity_Id) return Boolean; @@ -390,12 +389,24 @@ package body Sem_Ch10 is elsif Nkind (Cont_Item) = N_Use_Type_Clause and then not Used_Type_Or_Elab then - Subt_Mark := Subtype_Mark (Cont_Item); - if not Used_Type_Or_Elab - and then Same_Unit (Prefix (Subt_Mark), Nam_Ent) - then - Used_Type_Or_Elab := True; - end if; + declare + UE : Node_Id; + + begin + -- Loop through prefixes looking for a match + + UE := Prefix (Subtype_Mark (Cont_Item)); + loop + if not Used_Type_Or_Elab + and then Same_Unit (UE, Nam_Ent) + then + Used_Type_Or_Elab := True; + end if; + + exit when Nkind (UE) /= N_Expanded_Name; + UE := Prefix (UE); + end loop; + end; -- Pragma Elaborate or Elaborate_All |