https://gcc.gnu.org/g:51b0fc2d0442c18b76782681a0c6d50007fe3e18

commit r17-1319-g51b0fc2d0442c18b76782681a0c6d50007fe3e18
Author: Piotr Trojanek <[email protected]>
Date:   Mon Jun 24 11:34:15 2024 +0200

    ada: Simplify code with membership test
    
    Code cleanup; semantics is unaffected.
    
    gcc/ada/ChangeLog:
    
            * sem_ch13.adb (Rep_Item_Too_Late): Simplify with membership test.

Diff:
---
 gcc/ada/sem_ch13.adb | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 43120d794005..722999da4594 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -16976,16 +16976,15 @@ package body Sem_Ch13 is
       --  but avoid chaining if we have an overloadable entity, and the pragma
       --  is one that can apply to multiple overloaded entities.
 
-      if Is_Overloadable (T) and then Nkind (N) = N_Pragma then
-         declare
-            Pname : constant Name_Id := Pragma_Name (N);
-         begin
-            if Pname in Name_Convention | Name_Import | Name_Export
-                      | Name_External   | Name_Interface
-            then
-               return False;
-            end if;
-         end;
+      if Is_Overloadable (T)
+        and then Nkind (N) = N_Pragma
+        and then Pragma_Name (N) in Name_Convention
+                                  | Name_Import
+                                  | Name_Export
+                                  | Name_External
+                                  | Name_Interface
+      then
+         return False;
       end if;
 
       Record_Rep_Item (T, N);

Reply via email to