diff options
author | Thomas Quinot <quinot@adacore.com> | 2012-01-30 11:39:58 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-01-30 12:39:58 +0100 |
commit | 7873037fd8ad42ad0494cb2f5d7044309381183c (patch) | |
tree | ec6bf83bc929b3be00973cb3f3a43eb911058903 /gcc | |
parent | 6d9e03cb09911ae858fa1522f49a06f4fd852879 (diff) | |
download | gcc-7873037fd8ad42ad0494cb2f5d7044309381183c.zip gcc-7873037fd8ad42ad0494cb2f5d7044309381183c.tar.gz gcc-7873037fd8ad42ad0494cb2f5d7044309381183c.tar.bz2 |
s-rannum.adb, [...] (Get_Seed): Return Unsigned_64 rather than Duration.
2012-01-30 Thomas Quinot <quinot@adacore.com>
* s-rannum.adb, s-ransee.adb, s-ransee.ads (Get_Seed): Return
Unsigned_64 rather than Duration.
(System.Random_Numbers.Reset): Use full value of seed
(do not truncate sub-second bits).
2012-01-30 Thomas Quinot <quinot@adacore.com>
* sem_cat.adb, sem_ch12.adb: Minor reformatting.
From-SVN: r183708
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/ada/s-rannum.adb | 8 | ||||
-rw-r--r-- | gcc/ada/s-ransee.adb | 16 | ||||
-rw-r--r-- | gcc/ada/s-ransee.ads | 6 | ||||
-rw-r--r-- | gcc/ada/sem_cat.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_ch12.adb | 2 |
6 files changed, 32 insertions, 15 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b4253e6..40f7e2f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2012-01-30 Thomas Quinot <quinot@adacore.com> + + * s-rannum.adb, s-ransee.adb, s-ransee.ads (Get_Seed): Return + Unsigned_64 rather than Duration. + (System.Random_Numbers.Reset): Use full value of seed + (do not truncate sub-second bits). + +2012-01-30 Thomas Quinot <quinot@adacore.com> + + * sem_cat.adb, sem_ch12.adb: Minor reformatting. + 2012-01-30 Yannick Moy <moy@adacore.com> * gnat_ugn.texi: Minor correction of GNAT UG, to take into diff --git a/gcc/ada/s-rannum.adb b/gcc/ada/s-rannum.adb index 4e5e1d5..ca38408 100644 --- a/gcc/ada/s-rannum.adb +++ b/gcc/ada/s-rannum.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2007-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2007-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -480,12 +480,8 @@ package body System.Random_Numbers is ----------- procedure Reset (Gen : Generator) is - X : constant Unsigned_32 := - Unsigned_32'Mod (Unsigned_64 (Random_Seed.Get_Seed) * 64); - -- Why * 64 ??? - begin - Init (Gen, X); + Init (Gen, Unsigned_32'Mod (Random_Seed.Get_Seed)); end Reset; procedure Reset (Gen : Generator; Initiator : Integer_32) is diff --git a/gcc/ada/s-ransee.adb b/gcc/ada/s-ransee.adb index ad0833a..94e585f6 100644 --- a/gcc/ada/s-ransee.adb +++ b/gcc/ada/s-ransee.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2011-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -32,16 +32,24 @@ -- Version used on all systems except Ravenscar where Calendar is unavailable with Ada.Calendar; use Ada.Calendar; +with Ada.Unchecked_Conversion; package body System.Random_Seed is Y2K : constant Time := Time_Of (Year => 2000, Month => 1, Day => 1, Seconds => 0.0); - -- First day of Year 2000, to get a duration. + -- First day of Year 2000, to get a duration - function Get_Seed return Duration is + function To_U64 is + new Ada.Unchecked_Conversion (Duration, Interfaces.Unsigned_64); + + -------------- + -- Get_Seed -- + -------------- + + function Get_Seed return Interfaces.Unsigned_64 is begin - return Clock - Y2K; + return To_U64 (Clock - Y2K); end Get_Seed; end System.Random_Seed; diff --git a/gcc/ada/s-ransee.ads b/gcc/ada/s-ransee.ads index d5414ef..f627fc9 100644 --- a/gcc/ada/s-ransee.ads +++ b/gcc/ada/s-ransee.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2011-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 2011-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -39,9 +39,11 @@ -- This is required because Ada.Calendar cannot be used on Ravenscar, but -- Ada.Real_Time drags in the whole tasking runtime on regular platforms. +with Interfaces; + package System.Random_Seed is - function Get_Seed return Duration; + function Get_Seed return Interfaces.Unsigned_64; -- Get a seed based on the clock end System.Random_Seed; diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb index be594cb..91d731f1 100644 --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -491,8 +491,8 @@ package body Sem_Cat is Nkind (Unit (Cunit (Current_Sem_Unit))); begin - -- There are no constraints on body of remote_call_interface or - -- remote_types packages. + -- There are no constraints on the body of Remote_Call_Interface or + -- Remote_Types packages. return (Unit_Entity /= Standard_Standard) and then (Is_Preelaborated (Unit_Entity) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 34c100e..690da5c 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -9410,7 +9410,7 @@ package body Sem_Ch12 is Set_Corresponding_Generic_Association (Decl_Node, Act_Assoc); - -- The analysis of the actual may produce insert_action nodes, so + -- The analysis of the actual may produce Insert_Action nodes, so -- the declaration must have a context in which to attach them. Append (Decl_Node, List); |