aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-11-23 13:47:39 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-14 10:51:55 -0500
commitb27e311783fd5fc6932a748c88cb8b7b1ed956c6 (patch)
tree767bd4b351ddb534793960a3c52fffe7fd4bb7e4 /gcc
parent951d7d1319923e5188df3224a9f79ee5804bac80 (diff)
downloadgcc-b27e311783fd5fc6932a748c88cb8b7b1ed956c6.zip
gcc-b27e311783fd5fc6932a748c88cb8b7b1ed956c6.tar.gz
gcc-b27e311783fd5fc6932a748c88cb8b7b1ed956c6.tar.bz2
[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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_attr.adb45
1 files changed, 16 insertions, 29 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 504ca97..847d863 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 --