+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
-- --
-- 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- --
-----------
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
-- --
-- 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- --
-- 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;
-- --
-- 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- --
-- 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;
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)
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);