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

* sem_attr.adb (Analyze_Attribute): Consistently call
Check_Fixed_Point_Type before checking the number of attribute
expressions (like it is done for floating point types); reuse
Check_Fixed_Point_Type_0.

gcc/ada/sem_attr.adb

index 58cb92fb54b8734cdffe175ef0c3b47df3f23bd8..07719614edc0044a9a7d8f7f474975dbf2ffc63d 100644 (file)
@@ -4112,8 +4112,8 @@ package body Sem_Attr is
       -----------------
 
       when Attribute_Fixed_Value =>
-         Check_E1;
          Check_Fixed_Point_Type;
+         Check_E1;
          Resolve (E1, Any_Integer);
          Set_Etype (N, P_Base_Type);
 
@@ -6035,8 +6035,7 @@ package body Sem_Attr is
       when Attribute_Small_Denominator
          | Attribute_Small_Numerator
       =>
-         Check_E0;
-         Check_Fixed_Point_Type;
+         Check_Fixed_Point_Type_0;
          Set_Etype (N, Universal_Integer);
 
       ------------------