aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-11-23 16:40:06 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-15 06:41:49 -0500
commite30609bf042cbc937bece4ae00347a37f76af87f (patch)
tree235f00a9f31bdef38f25e10b3a954498e0239408
parenta8ecf5ec3288acf2c6578de794050764189bf12d (diff)
downloadgcc-e30609bf042cbc937bece4ae00347a37f76af87f.zip
gcc-e30609bf042cbc937bece4ae00347a37f76af87f.tar.gz
gcc-e30609bf042cbc937bece4ae00347a37f76af87f.tar.bz2
[Ada] Refactor duplicated code for Adjacent, Copy_Sign and Remainder
gcc/ada/ * sem_attr.adb (Analyze_Attribute): Merge identical code for Adjacent, Copy_Sign and Remainder attributes. (Check_Floating_Point_Type_2): Fix style in comment.
-rw-r--r--gcc/ada/sem_attr.adb19
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 3a05565..8f118af 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -348,7 +348,7 @@ package body Sem_Attr is
procedure Check_Floating_Point_Type_2;
-- Verify that prefix of attribute N is a float type and that
- -- two attribute expressions are present
+ -- two attribute expressions are present.
procedure Check_Integer_Type;
-- Verify that prefix of attribute N is an integer type
@@ -3159,7 +3159,10 @@ package body Sem_Attr is
-- Adjacent --
--------------
- when Attribute_Adjacent =>
+ when Attribute_Adjacent
+ | Attribute_Copy_Sign
+ | Attribute_Remainder
+ =>
Check_Floating_Point_Type_2;
Set_Etype (N, P_Base_Type);
Resolve (E1, P_Base_Type);
@@ -3617,11 +3620,7 @@ package body Sem_Attr is
-- Copy_Sign --
---------------
- when Attribute_Copy_Sign =>
- Check_Floating_Point_Type_2;
- Set_Etype (N, P_Base_Type);
- Resolve (E1, P_Base_Type);
- Resolve (E2, P_Base_Type);
+ -- Shares processing with Adjacent attribute
-----------
-- Count --
@@ -5710,11 +5709,7 @@ package body Sem_Attr is
-- Remainder --
---------------
- when Attribute_Remainder =>
- Check_Floating_Point_Type_2;
- Set_Etype (N, P_Base_Type);
- Resolve (E1, P_Base_Type);
- Resolve (E2, P_Base_Type);
+ -- Shares processing with Adjacent attribute
---------------------
-- Restriction_Set --