aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-12-11 03:57:08 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-04-29 04:00:43 -0400
commitace51190c628d06c12af458dd0b46b99c4e30a4b (patch)
treee29b924361927e81d5b4f04879e3be65c4b5cc88 /gcc
parent2d98b9a9a8a4a5eb3f361b7e5fc06b7041ba45e6 (diff)
downloadgcc-ace51190c628d06c12af458dd0b46b99c4e30a4b.zip
gcc-ace51190c628d06c12af458dd0b46b99c4e30a4b.tar.gz
gcc-ace51190c628d06c12af458dd0b46b99c4e30a4b.tar.bz2
[Ada] AI12-0407: Fixups on Big_Integers and Big_Reals
gcc/ada/ * libgnat/a-nbnbin.ads (From_Universal_Image): New. (Big_Integer): Update definition. * libgnat/a-nbnbre.ads, libgnat/a-nbnbre.adb (From_Universal_Image): New. (From_String): Remove alternate body, replaced by From_Universal_Image. (Big_Real): Update definition.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/libgnat/a-nbnbin.ads5
-rw-r--r--gcc/ada/libgnat/a-nbnbre.adb7
-rw-r--r--gcc/ada/libgnat/a-nbnbre.ads11
3 files changed, 12 insertions, 11 deletions
diff --git a/gcc/ada/libgnat/a-nbnbin.ads b/gcc/ada/libgnat/a-nbnbin.ads
index 668da8d..31a8bc9 100644
--- a/gcc/ada/libgnat/a-nbnbin.ads
+++ b/gcc/ada/libgnat/a-nbnbin.ads
@@ -22,7 +22,7 @@ package Ada.Numerics.Big_Numbers.Big_Integers
with Preelaborate
is
type Big_Integer is private
- with Integer_Literal => From_String,
+ with Integer_Literal => From_Universal_Image,
Put_Image => Put_Image;
function Is_Valid (Arg : Big_Integer) return Boolean
@@ -116,6 +116,9 @@ is
function From_String (Arg : String) return Valid_Big_Integer
with Global => null;
+ function From_Universal_Image (Arg : String) return Valid_Big_Integer
+ renames From_String;
+
procedure Put_Image (S : in out Sink'Class; V : Big_Integer);
function "+" (L : Valid_Big_Integer) return Valid_Big_Integer
diff --git a/gcc/ada/libgnat/a-nbnbre.adb b/gcc/ada/libgnat/a-nbnbre.adb
index 4ff5b35..d475b86 100644
--- a/gcc/ada/libgnat/a-nbnbre.adb
+++ b/gcc/ada/libgnat/a-nbnbre.adb
@@ -593,13 +593,6 @@ package body Ada.Numerics.Big_Numbers.Big_Reals is
end;
end From_String;
- function From_String
- (Numerator, Denominator : String) return Valid_Big_Real is
- begin
- return Big_Integers.From_String (Numerator) /
- Big_Integers.From_String (Denominator);
- end From_String;
-
--------------------------
-- From_Quotient_String --
--------------------------
diff --git a/gcc/ada/libgnat/a-nbnbre.ads b/gcc/ada/libgnat/a-nbnbre.ads
index ee5636f..eb7c8a7 100644
--- a/gcc/ada/libgnat/a-nbnbre.ads
+++ b/gcc/ada/libgnat/a-nbnbre.ads
@@ -21,7 +21,7 @@ package Ada.Numerics.Big_Numbers.Big_Reals
with Preelaborate
is
type Big_Real is private with
- Real_Literal => From_String,
+ Real_Literal => From_Universal_Image,
Put_Image => Put_Image;
function Is_Valid (Arg : Big_Real) return Boolean
@@ -122,8 +122,13 @@ is
function From_String (Arg : String) return Valid_Big_Real
with Global => null;
- function From_String (Numerator, Denominator : String) return Valid_Big_Real
- with Global => null;
+
+ function From_Universal_Image (Arg : String) return Valid_Big_Real
+ renames From_String;
+ function From_Universal_Image (Num, Den : String) return Valid_Big_Real is
+ (Big_Integers.From_Universal_Image (Num) /
+ Big_Integers.From_Universal_Image (Den))
+ with Global => null;
function To_Quotient_String (Arg : Big_Real) return String is
(Big_Integers.To_String (Numerator (Arg)) & " / "