[Ada] Refactor repeated code for component attributes
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 23 Nov 2020 22:44:06 +0000 (23:44 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 15 Dec 2020 11:41:51 +0000 (06:41 -0500)
gcc/ada/

* sem_attr.adb (Analyze_Attribute): Merge identical code for
First_Bit/Last_Bit and Position attributes.

gcc/ada/sem_attr.adb

index 30fdfb8c55d62e5fff3e849a0612580654284770..537da93dc662dc0b9026242401dcf2e00b28a2a5 100644 (file)
@@ -4094,6 +4094,7 @@ package body Sem_Attr is
 
       when Attribute_First_Bit
          | Attribute_Last_Bit
+         | Attribute_Position
       =>
          Check_Component;
          Set_Etype (N, Universal_Integer);
@@ -5305,9 +5306,7 @@ package body Sem_Attr is
       -- Position --
       --------------
 
-      when Attribute_Position =>
-         Check_Component;
-         Set_Etype (N, Universal_Integer);
+      --  Shares processing with First_Bit attribute
 
       ----------
       -- Pred --