From: Piotr Trojanek Date: Mon, 23 Nov 2020 12:47:39 +0000 (+0100) Subject: [Ada] Refactor duplicated code for floating point attributes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b27e311783fd5fc6932a748c88cb8b7b1ed956c6;p=gcc.git [Ada] Refactor duplicated code for floating point attributes gcc/ada/ * sem_attr.adb (Analyze_Attribute): Merge identical code for Ceiling, Floor, Fraction, Machine, Machine_Rounding, Model, Rounding and Unbiased_Rounding. --- diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 504ca9738f7..847d86359a7 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3395,7 +3395,15 @@ package body Sem_Attr is -- Ceiling -- ------------- - when Attribute_Ceiling => + when Attribute_Ceiling + | Attribute_Floor + | Attribute_Fraction + | Attribute_Machine + | Attribute_Machine_Rounding + | Attribute_Model + | Attribute_Rounding + | Attribute_Unbiased_Rounding + => Check_Floating_Point_Type_1; Set_Etype (N, P_Base_Type); Resolve (E1, P_Base_Type); @@ -4091,10 +4099,7 @@ package body Sem_Attr is -- Floor -- ----------- - when Attribute_Floor => - Check_Floating_Point_Type_1; - Set_Etype (N, P_Base_Type); - Resolve (E1, P_Base_Type); + -- Shares processing with Ceiling attribute ---------- -- Fore -- @@ -4108,10 +4113,7 @@ package body Sem_Attr is -- Fraction -- -------------- - when Attribute_Fraction => - Check_Floating_Point_Type_1; - Set_Etype (N, P_Base_Type); - Resolve (E1, P_Base_Type); + -- Shares processing with Ceiling attribute -------------- -- From_Any -- @@ -4690,10 +4692,7 @@ package body Sem_Attr is -- Machine -- ------------- - when Attribute_Machine => - Check_Floating_Point_Type_1; - Set_Etype (N, P_Base_Type); - Resolve (E1, P_Base_Type); + -- Shares processing with Ceiling attribute ------------------ -- Machine_Emax -- @@ -4741,10 +4740,7 @@ package body Sem_Attr is -- Machine_Rounding -- ---------------------- - when Attribute_Machine_Rounding => - Check_Floating_Point_Type_1; - Set_Etype (N, P_Base_Type); - Resolve (E1, P_Base_Type); + -- Shares processing with Ceiling attribute -------------------- -- Machine_Rounds -- @@ -4866,10 +4862,7 @@ package body Sem_Attr is -- Model -- ----------- - when Attribute_Model => - Check_Floating_Point_Type_1; - Set_Etype (N, P_Base_Type); - Resolve (E1, P_Base_Type); + -- Shares processing with Ceiling attribute ---------------- -- Model_Emin -- @@ -5844,10 +5837,7 @@ package body Sem_Attr is -- Rounding -- -------------- - when Attribute_Rounding => - Check_Floating_Point_Type_1; - Set_Etype (N, P_Base_Type); - Resolve (E1, P_Base_Type); + -- Shares processing with Ceiling attribute --------------- -- Safe_Emax -- @@ -6611,10 +6601,7 @@ package body Sem_Attr is -- Unbiased_Rounding -- ----------------------- - when Attribute_Unbiased_Rounding => - Check_Floating_Point_Type_1; - Set_Etype (N, P_Base_Type); - Resolve (E1, P_Base_Type); + -- Shares processing with Ceiling attribute ---------------------- -- Unchecked_Access --