[Ada] Refactor repeated code for Value attributes
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 24 Nov 2020 15:01:52 +0000 (16:01 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 15 Dec 2020 11:41:53 +0000 (06:41 -0500)
gcc/ada/

* sem_attr.adb (Analyze_Attribute): Reuse existing code for
attribute Value when analyzing attributes Wide_Value and
Wide_Wide_Value.

gcc/ada/sem_attr.adb

index 865bbae4885a0f039ad5c2c230003ddc5e0550a4..d5970a1f62c95870fef02b42e9b92c4c2448c52e 100644 (file)
@@ -7088,7 +7088,10 @@ package body Sem_Attr is
       -- Value --
       -----------
 
-      when Attribute_Value =>
+      when Attribute_Value
+         | Attribute_Wide_Value
+         | Attribute_Wide_Wide_Value
+      =>
          Check_E1;
          Check_Scalar_Type;
 
@@ -7174,45 +7177,13 @@ package body Sem_Attr is
       -- Wide_Value --
       ----------------
 
-      when Attribute_Wide_Value =>
-         Check_E1;
-         Check_Scalar_Type;
-
-         --  Set Etype before resolving expression because expansion
-         --  of expression may require enclosing type.
-
-         Set_Etype (N, P_Type);
-         Validate_Non_Static_Attribute_Function_Call;
-
-         --  Check restriction No_Fixed_IO
-
-         if Restriction_Check_Required (No_Fixed_IO)
-           and then Is_Fixed_Point_Type (P_Type)
-         then
-            Check_Restriction (No_Fixed_IO, P);
-         end if;
+      --  Shares processing with Value attribute
 
       ---------------------
       -- Wide_Wide_Value --
       ---------------------
 
-      when Attribute_Wide_Wide_Value =>
-         Check_E1;
-         Check_Scalar_Type;
-
-         --  Set Etype before resolving expression because expansion
-         --  of expression may require enclosing type.
-
-         Set_Etype (N, P_Type);
-         Validate_Non_Static_Attribute_Function_Call;
-
-         --  Check restriction No_Fixed_IO
-
-         if Restriction_Check_Required (No_Fixed_IO)
-           and then Is_Fixed_Point_Type (P_Type)
-         then
-            Check_Restriction (No_Fixed_IO, P);
-         end if;
+      --  Shares processing with Value attribute
 
       ---------------------
       -- Wide_Wide_Width --