diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-11-24 16:01:52 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-12-15 06:41:53 -0500 |
commit | b2304663888042a75a07851833519842a953cecb (patch) | |
tree | 22e03949032e5a02fe56c035691986ac37c8c89f | |
parent | 3a6021dc1de871fc561ed0a60f1446a380d77c06 (diff) | |
download | gcc-b2304663888042a75a07851833519842a953cecb.zip gcc-b2304663888042a75a07851833519842a953cecb.tar.gz gcc-b2304663888042a75a07851833519842a953cecb.tar.bz2 |
[Ada] Refactor repeated code for Value attributes
gcc/ada/
* sem_attr.adb (Analyze_Attribute): Reuse existing code for
attribute Value when analyzing attributes Wide_Value and
Wide_Wide_Value.
-rw-r--r-- | gcc/ada/sem_attr.adb | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 865bbae..d5970a1 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -7088,7 +7088,10 @@ package body Sem_Attr is -- Value -- ----------- - when Attribute_Value => + when Attribute_Value + | Attribute_Wide_Value + | Attribute_Wide_Wide_Value + => Check_E1; Check_Scalar_Type; @@ -7174,45 +7177,13 @@ package body Sem_Attr is -- Wide_Value -- ---------------- - when Attribute_Wide_Value => - Check_E1; - Check_Scalar_Type; - - -- Set Etype before resolving expression because expansion - -- of expression may require enclosing type. - - Set_Etype (N, P_Type); - Validate_Non_Static_Attribute_Function_Call; - - -- Check restriction No_Fixed_IO - - if Restriction_Check_Required (No_Fixed_IO) - and then Is_Fixed_Point_Type (P_Type) - then - Check_Restriction (No_Fixed_IO, P); - end if; + -- Shares processing with Value attribute --------------------- -- Wide_Wide_Value -- --------------------- - when Attribute_Wide_Wide_Value => - Check_E1; - Check_Scalar_Type; - - -- Set Etype before resolving expression because expansion - -- of expression may require enclosing type. - - Set_Etype (N, P_Type); - Validate_Non_Static_Attribute_Function_Call; - - -- Check restriction No_Fixed_IO - - if Restriction_Check_Required (No_Fixed_IO) - and then Is_Fixed_Point_Type (P_Type) - then - Check_Restriction (No_Fixed_IO, P); - end if; + -- Shares processing with Value attribute --------------------- -- Wide_Wide_Width -- |