public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4306] [Ada] Simplify membership tests with N_Generic_Declaration
@ 2021-10-11 13:40 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-10-11 13:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:945ec76b8e110e2ef291777e123482389f6594e6

commit r12-4306-g945ec76b8e110e2ef291777e123482389f6594e6
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Oct 5 14:12:46 2021 +0200

    [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.

Diff:
---
 gcc/ada/sem_ch10.adb |  7 ++-----
 gcc/ada/sem_prag.adb |  4 +---
 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 75a03797c2d..5b54e7d0de9 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 0163ff94d42..b3fa32ad5c0 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 4f8426ab53f..e79c5345f1d 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;
 
    ---------------------------


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-11 13:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 13:40 [gcc r12-4306] [Ada] Simplify membership tests with N_Generic_Declaration Pierre-Marie de Rodat

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).