From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id 83D9B3955419 for ; Thu, 29 Apr 2021 08:03:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 83D9B3955419 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=derodat@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 566B6561B2; Thu, 29 Apr 2021 04:03:47 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id N12NSb65fOuw; Thu, 29 Apr 2021 04:03:47 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) by rock.gnat.com (Postfix) with ESMTP id 3EDBB561AF; Thu, 29 Apr 2021 04:03:47 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 3DFC7193; Thu, 29 Apr 2021 04:03:47 -0400 (EDT) Date: Thu, 29 Apr 2021 04:03:47 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Arnaud Charlet Subject: [Ada] AI12-0407: Fixups on Big_Integers and Big_Reals Message-ID: <20210429080347.GA133818@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2021 08:03:51 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This AI updates among other things some declarations in big number packages. Tested on x86_64-pc-linux-gnu, committed on trunk 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. --BOKacYhQ+x31HxR3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" diff --git a/gcc/ada/libgnat/a-nbnbin.ads b/gcc/ada/libgnat/a-nbnbin.ads --- 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 --- 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 --- 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)) & " / " --BOKacYhQ+x31HxR3--