diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2021-10-05 14:12:46 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-10-11 13:38:11 +0000 |
commit | 945ec76b8e110e2ef291777e123482389f6594e6 (patch) | |
tree | 067c58fa68597e68516baaea6116e856ab06b268 | |
parent | 35338c60e4634e29d8704df6e7012fcdc7eb909c (diff) | |
download | gcc-945ec76b8e110e2ef291777e123482389f6594e6.zip gcc-945ec76b8e110e2ef291777e123482389f6594e6.tar.gz gcc-945ec76b8e110e2ef291777e123482389f6594e6.tar.bz2 |
[Ada] Simplify membership tests with N_Generic_Declaration
gcc/ada/
* sem_ch10.adb, sem_prag.adb, sem_util.adb: Use
N_Generic_Declaration in membership tests.
-rw-r--r-- | gcc/ada/sem_ch10.adb | 7 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 15 |
3 files changed, 7 insertions, 19 deletions
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 75a0379..5b54e7d 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -4162,8 +4162,7 @@ package body Sem_Ch10 is end if; if Ekind (P_Name) = E_Generic_Package - and then Nkind (Lib_Unit) not in N_Generic_Subprogram_Declaration - | N_Generic_Package_Declaration + and then Nkind (Lib_Unit) not in N_Generic_Declaration | N_Generic_Renaming_Declaration then Error_Msg_N @@ -6193,9 +6192,7 @@ package body Sem_Ch10 is ("subprogram not allowed in `LIMITED WITH` clause", N); return; - when N_Generic_Package_Declaration - | N_Generic_Subprogram_Declaration - => + when N_Generic_Declaration => Error_Msg_N ("generic not allowed in `LIMITED WITH` clause", N); return; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 0163ff9..b3fa32a 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -6678,9 +6678,7 @@ package body Sem_Prag is then Pragma_Misplaced; - elsif (Nkind (Parent_Node) = N_Generic_Package_Declaration - or else Nkind (Parent_Node) = - N_Generic_Subprogram_Declaration) + elsif Nkind (Parent_Node) in N_Generic_Declaration and then Plist = Generic_Formal_Declarations (Parent_Node) then Pragma_Misplaced; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 4f8426a..e79c534 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -8030,8 +8030,7 @@ package body Sem_Util is if Present (Spec_Id) and then Nkind (Unit_Declaration_Node (Spec_Id)) in - N_Generic_Package_Declaration | - N_Generic_Subprogram_Declaration + N_Generic_Declaration then return Par; end if; @@ -8055,9 +8054,7 @@ package body Sem_Util is begin Par := Parent (N); while Present (Par) loop - if Nkind (Par) in N_Generic_Package_Declaration - | N_Generic_Subprogram_Declaration - then + if Nkind (Par) in N_Generic_Declaration then return Par; elsif Nkind (Par) in N_Package_Body | N_Subprogram_Body then @@ -8066,9 +8063,7 @@ package body Sem_Util is if Present (Spec_Id) then Spec_Decl := Unit_Declaration_Node (Spec_Id); - if Nkind (Spec_Decl) in N_Generic_Package_Declaration - | N_Generic_Subprogram_Declaration - then + if Nkind (Spec_Decl) in N_Generic_Declaration then return Spec_Decl; end if; end if; @@ -17891,9 +17886,7 @@ package body Sem_Util is -- a generic body modifies the Ekind of its spec to allow for recursive -- calls. - return - Nkind (Spec_Decl) in N_Generic_Package_Declaration - | N_Generic_Subprogram_Declaration; + return Nkind (Spec_Decl) in N_Generic_Declaration; end Is_Generic_Declaration_Or_Body; --------------------------- |