===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 2000-2011, AdaCore --
-- --
-- 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- --
@@ -29,11 +29,6 @@
-- --
------------------------------------------------------------------------------
-pragma Ada_95;
-
with Ada.Exceptions;
with Ada.Text_IO;
with Ada.Strings.Unbounded;
@@ -735,30 +730,18 @@
-- Current_Session --
---------------------
- function Current_Session return Session_Type is
+ function Current_Session return not null access Session_Type is
begin
- pragma Warnings (Off);
- return Cur_Session;
- -- ???The above return statement violates the Ada 2005 rule forbidding
- -- copying of limited objects (see RM-7.5(2.8/2)). When compiled with
- -- -gnatg, the compiler gives a warning instead of an error, so we can
- -- turn it off.
- pragma Warnings (On);
+ return Cur_Session.Self;
end Current_Session;
---------------------
-- Default_Session --
---------------------
- function Default_Session return Session_Type is
+ function Default_Session return not null access Session_Type is
begin
- pragma Warnings (Off);
- return Def_Session;
- -- ???The above return statement violates the Ada 2005 rule forbidding
- -- copying of limited objects (see RM-7.5(2.8/2)). When compiled with
- -- -gnatg, the compiler gives a warning instead of an error, so we can
- -- turn it off.
- pragma Warnings (On);
+ return Def_Session.Self;
end Default_Session;
--------------------
===================================================================
@@ -229,12 +229,12 @@
-- Set the session to be used by default. This file will be used when the
-- Session parameter in following services is not specified.
- function Current_Session return Session_Type;
+ function Current_Session return not null access Session_Type;
-- Returns the session used by default by all services. This is the
-- latest session specified by Set_Current service or the session
-- provided by default with this implementation.
- function Default_Session return Session_Type;
+ function Default_Session return not null access Session_Type;
-- Returns the default session provided by this package. Note that this is
-- the session return by Current_Session if Set_Current has not been used.
@@ -633,6 +633,7 @@
type Session_Type is new Ada.Finalization.Limited_Controlled with record
Data : Session_Data_Access;
+ Self : not null access Session_Type := Session_Type'Unchecked_Access;
end record;
procedure Initialize (Session : in out Session_Type);