This changes the implementation of input operations for floating-point
types from using Long_Long_Float for all floating-point types to using
a base type tailored to the type being operated on.

This comprises adjusting Ada.Text_IO.Float_IO and Ada.Text_IO.Complex_IO
to the new approach, as well as sibling packages in the Ada.Wide_Text_IO
and Ada.Wide_Wide_Text_IO hierarchies.

Note that this skips Short_Float, because Short_Float has always been a
copy of Float for GNAT and, for good measures, remove System.Fat_SFlt.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Remove s-fatsfl$(objext)
        and add s-valflt$(objext), s-vallfl$(objext), s-valllf$(objext).
        * exp_attr.adb (Find_Fat_Info): Merge Short_Float and Float cases.
        * exp_imgv.adb (Expand_Value_Attribute): Replace RE_Value_Real with
        RE_Value_Long_Long_Float for fixed-point types and use appropriate
        base type for floating-point types.
        * rtsfind.ads (RTU_Id): Remove System_Fat_IEEE_Long_Float,
        System_Fat_IEEE_Short_Float and System_Val_Real, add System_Val_Flt,
        System_Val_LFlt and System_Val_LLF.
        (RE_Id): Remove RE_Attr_IEEE_Long, RE_Fat_IEEE_Long,
        RE_Attr_IEEE_Short, RE_Fat_IEEE_Short, RE_Attr_Short_Float, add
        RE_Value_Float, RE_Value_Long_Float, RE_Value_Long_Long_Float,
        (RE_Unit_Table): Likewise.
        * libgnat/a-ticoau.ads: Add with clause for Float_Aux and make the
        package generic.
        (Get): Change parameter types to Num.
        (Put): Likewise.
        (Gets): Likewise.
        (Puts): Likewise.
        * libgnat/a-ticoau.adb: Remove clause and renaming for Float_Aux.
        (Get): Change parameter types to Num.
        (Gets): Likewise.
        (Put): Likewise.
        (Puts): Likewise.  Add conversion to Long_Long_Float.
        * libgnat/a-ticoio.adb: Remove with clause for Ada.Text_IO, add with
        clause for Float_Aux, add with and use clauses for System.Val_Flt,
        System.Val_LFlt and System.Val_LLF. Instantiate Float_Aux and
        Complex_Aux on Float, Long_Float, and Long_Long_Float.
        (OK_Float): New boolean constant.
        (OK_Long_Float): Likewise.
        (Get): Call appropriate Get routine from auxiliary package.
        (Get): Call appropriate Gets routine from auxiliary package.
        (Put): Call appropriate Put routine from auxiliary package.
        (Put): Call appropriate Puts routine from auxiliary package.
        * libgnat/a-tideau.adb: Remove with and use clause for Float_Aux.
        * libgnat/a-tifiau.adb: Likewise.
        * libgnat/a-tifiio.adb: Add with and use clause for System.Val_LLF.
        Instantiate Float_Aux on Long_Long_Float.
        (Get): Adjust call to Get routine from auxiliary package.
        (Get): Adjust call to Gets routine from auxiliary package.
        (Put): Adjust call to Put routine from auxiliary package.
        (Put): Adjust call to Puts routine from auxiliary package.
        * libgnat/a-tifiio__128.adb: Likewise.
        (Get): Likewise.
        (Get): Likewise.
        (Put): Likewise.
        (Put): Likewise.
        * libgnat/a-tiflau.ads: Make the package generic.
        (Get): Change parameter type to Num.
        (Put): Likewise.
        (Gets): Likewise.
        (Puts): Likewise.
        * libgnat/a-tiflau.adb: Remove clauses for System.Val_Real.
        (Get): Change parameter type to Num and call Scan routine.
        (Gets): Likewise.
        (Load_Real): Move to...
        (Put): Change parameter type and add conversion to Long_Long_Float.
        (Puts): Likewise.
        * libgnat/a-tiflio.adb: Add with and use clauses for System.Val_Flt,
        System.Val_LFlt and System.Val_LLF. Instantiate Float_Aux on Float,
        Long_Float and Long_Long_Float.
        (OK_Float): New boolean constant.
        (OK_Long_Float): Likewise.
        (Get): Call appropriate Get routine from auxiliary package.
        (Get): Call previous variant.
        (Get): Call appropriate Gets routine from auxiliary package.
        (Put): Call appropriate Put routine from auxiliary package.
        (Put): Call previous variant.
        (Put): Call appropriate Puts routine from auxiliary package.
        * libgnat/a-tigeau.ads (Load_Real): New procedure.
        * libgnat/a-tigeau.adb (Load_Real): ...here.
        * libgnat/a-wtcoau.ads: Add with clause for Float_Aux and make the
        package generic.
        (Get): Change parameter types to Num.
        (Put): Likewise.
        (Gets): Likewise.
        (Puts): Likewise.
        * libgnat/a-wtcoau.adb: Remove clause and renaming for Float_Aux.
        (Get): Change parameter types to Num.
        (Gets): Likewise.
        (Put): Likewise.
        (Puts): Likewise.  Add conversion to Long_Long_Float.
        * libgnat/a-wtcoio.ads: Remove use clause for Complex_Types and use
        qualified names throughout accordingly.
        * libgnat/a-wtcoio.adb: Remove clause for Ada.Unchecked_Conversion,
        add with clause for Float_Aux, add clauses for System.Val_Flt,
        System.Val_LFlt and System.Val_LLF. Add clause for Complex_Types.
        Instantiate Float_Aux and Complex_Aux on Float, Long_Float, and
        Long_Long_Float.  Remove LLF subtype and TFT instantiation.
        (OK_Float): New boolean constant.
        (OK_Long_Float): Likewise.
        (Get): Call appropriate Get routine from auxiliary package.
        (Get): Call appropriate Gets routine from auxiliary package.
        (Put): Call appropriate Put routine from auxiliary package.
        (Put): Call appropriate Puts routine from auxiliary package.
        * libgnat/a-wtdeau.adb: Remove with and use clause for Float_Aux.
        * libgnat/a-wtfiau.adb: Likewise.
        * libgnat/a-wtfiio.adb: Add with and use clause for System.Val_LLF.
        Instantiate Float_Aux on Long_Long_Float.
        (Get): Adjust call to Get routine from auxiliary package.
        (Get): Adjust call to Gets routine from auxiliary package.
        (Put): Adjust call to Put routine from auxiliary package.
        (Put): Adjust call to Puts routine from auxiliary package.
        * libgnat/a-wtfiio__128.adb: Likewise.
        (Get): Likewise.
        (Get): Likewise.
        (Put): Likewise.
        (Put): Likewise.
        * libgnat/a-wtflau.ads: Make the package generic.
        (Get): Change parameter type to Num.
        (Put): Likewise.
        (Gets): Likewise.
        (Puts): Likewise.
        * libgnat/a-wtflau.adb: Remove clauses for System.Val_Real.
        (Get): Change parameter type to Num and call Scan routine. Set
        Ptr parameter lazily.
        (Gets): Likewise.
        (Load_Real): Move to...
        (Put): Change parameter type and add conversion to Long_Long_Float.
        Bump buffer length to Max_Real_Image_Length.
        (Puts): Likewise.
        * libgnat/a-wtflio.adb: Add with and use clauses for System.Val_Flt,
        System.Val_LFlt and System.Val_LLF. Instantiate Float_Aux on Float,
        Long_Float and Long_Long_Float.
        (OK_Float): New boolean constant.
        (OK_Long_Float): Likewise.
        (Get): Call appropriate Get routine from auxiliary package.  Add
        pragma Unsuppress (Range_Check) and manual validity check.
        (Get): Call appropriate Gets routine from auxiliary package. Add
        pragma Unsuppress (Range_Check) and manual validity check.
        (Put): Call appropriate Put routine from auxiliary package.
        (Put): Call appropriate Puts routine from auxiliary package.
        * libgnat/a-wtgeau.ads (Load_Real): New procedure.
        * libgnat/a-wtgeau.adb (Load_Real): ...here.
        * libgnat/a-ztcoau.ads: Add with clause for Float_Aux and make the
        package generic.
        (Get): Change parameter types to Num.
        (Put): Likewise.
        (Gets): Likewise.
        (Puts): Likewise.
        * libgnat/a-ztcoau.adb: Remove clause and renaming for Float_Aux.
        (Get): Change parameter types to Num.
        (Gets): Likewise.
        (Put): Likewise.
        (Puts): Likewise.  Add conversion to Long_Long_Float.
        * libgnat/a-ztcoio.ads: Remove use clause for Complex_Types and use
        qualified names throughout accordingly.
        * libgnat/a-ztcoio.adb: Remove clause for Ada.Unchecked_Conversion,
        add with clause for Float_Aux, add clauses for System.Val_Flt,
        System.Val_LFlt and System.Val_LLF. Add clause for Complex_Types.
        Instantiate Float_Aux and Complex_Aux on Float, Long_Float, and
        Long_Long_Float. Remove LLF subtype and TFT instantiation.
        (OK_Float): New boolean constant.
        (OK_Long_Float): Likewise.
        (Get): Call appropriate Get routine from auxiliary package.
        (Get): Call appropriate Gets routine from auxiliary package.
        (Put): Call appropriate Put routine from auxiliary package.
        (Put): Call appropriate Puts routine from auxiliary package.
        * libgnat/a-ztdeau.adb: Remove with and use clause for Float_Aux.
        * libgnat/a-ztfiau.adb: Likewise.
        * libgnat/a-ztfiio.adb: Add with and use clause for System.Val_LLF.
        Instantiate Float_Aux on Long_Long_Float.
        (Get): Adjust call to Get routine from auxiliary package.
        (Get): Adjust call to Gets routine from auxiliary package.
        (Put): Adjust call to Put routine from auxiliary package.
        (Put): Adjust call to Puts routine from auxiliary package.
        * libgnat/a-ztfiio__128.adb: Likewise.
        (Get): Likewise.
        (Get): Likewise.
        (Put): Likewise.
        (Put): Likewise.
        * libgnat/a-ztflau.ads: Make the package generic.
        (Get): Change parameter type to Num.
        (Put): Likewise.
        (Gets): Likewise.
        (Puts): Likewise.
        * libgnat/a-ztflau.adb: Remove clauses for System.Val_Real.
        (Get): Change parameter type to Num and call Scan routine. Set
        Ptr parameter lazily.
        (Gets): Likewise.
        (Load_Real): Move to...
        (Put): Change parameter type and add conversion to Long_Long_Float.
        Bump buffer length to Max_Real_Image_Length.
        (Puts): Likewise.
        * libgnat/a-ztflio.adb: Add with and use clauses for System.Val_Flt,
        System.Val_LFlt and System.Val_LLF. Instantiate Float_Aux on Float,
        Long_Float and Long_Long_Float.
        (OK_Float): New boolean constant.
        (OK_Long_Float): Likewise.
        (Get): Call appropriate Get routine from auxiliary package.  Add
        pragma Unsuppress (Range_Check) and manual validity check.
        (Get): Call appropriate Gets routine from auxiliary package. Add
        pragma Unsuppress (Range_Check) and manual validity check.
        (Put): Call appropriate Put routine from auxiliary package.
        (Put): Call appropriate Puts routine from auxiliary package.
        * libgnat/a-ztgeau.ads (Load_Real): New procedure.
        * libgnat/a-ztgeau.adb (Load_Real): ...here.
        * libgnat/s-fatsfl.ads: Delete.
        * libgnat/s-valflt.ads: New package.
        * libgnat/s-vallfl.ads: Likewise.
        * libgnat/s-valllf.ads: Likewise.
        * libgnat/s-valrea.ads: Make generic. Add assertions, defensive
        code and clarify intent.
        (Scan_Real): Change parameter type to Num.
        (Value_Real): Likewise.
        * libgnat/s-valrea.adb: Instantiate Value_R on Uns.
        (Integer_to_Real): Change parameter and result to Num.
        Call Float_Control.Reset only if the mantissa is 64 bits.  Use
        a divide to compute the final value if the scale is negative.
        (Scan_Real): Change result to Num.
        (Value_Real): Likewise.
        * libgnat/s-valuer.adb: Add assertions, defensive code and
        clarify intent.
        (F_Limit): Delete.
        (I_Limit): Likewise.
        (Precision_Limit): Always use the integer limit.
        * libgnat/s-fatgen.adb: Add pragma Annotate.

Attachment: patch.diff.gz
Description: application/gzip

Reply via email to