aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-11-23 23:21:19 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-15 06:41:50 -0500
commit156f9796d5050730ab45d99162ab4309c0bdc6ee (patch)
tree417f74155afefe07a94b09c6d05c35aed98aaa0c
parent82b4bbb7a4b4fdd285ccb8494ea3ef51494a57da (diff)
downloadgcc-156f9796d5050730ab45d99162ab4309c0bdc6ee.zip
gcc-156f9796d5050730ab45d99162ab4309c0bdc6ee.tar.gz
gcc-156f9796d5050730ab45d99162ab4309c0bdc6ee.tar.bz2
[Ada] Refactor repeated code for floating point attributes returning reals
gcc/ada/ * sem_attr.adb (Analyze_Attribute): Merge identical code for Epsilon, Model_Epsilon, Model_Small, Safe_First and Safe_Las attributes.
-rw-r--r--gcc/ada/sem_attr.adb23
1 files changed, 10 insertions, 13 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index d2eb62f..2e19bf6 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -4002,7 +4002,12 @@ package body Sem_Attr is
-- Epsilon --
-------------
- when Attribute_Epsilon =>
+ when Attribute_Epsilon
+ | Attribute_Model_Epsilon
+ | Attribute_Model_Small
+ | Attribute_Safe_First
+ | Attribute_Safe_Last
+ =>
Check_Floating_Point_Type_0;
Set_Etype (N, Universal_Real);
@@ -4876,9 +4881,7 @@ package body Sem_Attr is
-- Model_Epsilon --
-------------------
- when Attribute_Model_Epsilon =>
- Check_Floating_Point_Type_0;
- Set_Etype (N, Universal_Real);
+ -- Shares processing with Epsilon attribute
--------------------
-- Model_Mantissa --
@@ -4890,9 +4893,7 @@ package body Sem_Attr is
-- Model_Small --
-----------------
- when Attribute_Model_Small =>
- Check_Floating_Point_Type_0;
- Set_Etype (N, Universal_Real);
+ -- Shares processing with Epsilon attribute
-------------
-- Modulus --
@@ -5843,9 +5844,7 @@ package body Sem_Attr is
-- Safe_First --
----------------
- when Attribute_Safe_First =>
- Check_Floating_Point_Type_0;
- Set_Etype (N, Universal_Real);
+ -- Shares processing with Epsilon attribute
----------------
-- Safe_Large --
@@ -5860,9 +5859,7 @@ package body Sem_Attr is
-- Safe_Last --
---------------
- when Attribute_Safe_Last =>
- Check_Floating_Point_Type_0;
- Set_Etype (N, Universal_Real);
+ -- Shares processing with Epsilon attribute
----------------
-- Safe_Small --