aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-03 16:54:24 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-03 16:54:24 +0200
commit1cdfa9be54975f0566d6f261a706dcb8d767601d (patch)
tree3dfed43821a83ea125d3b2afd4c3d6fa17d004b1 /gcc
parent243cae0a5108e18638c9c4844baaf392171130d4 (diff)
downloadgcc-1cdfa9be54975f0566d6f261a706dcb8d767601d.zip
gcc-1cdfa9be54975f0566d6f261a706dcb8d767601d.tar.gz
gcc-1cdfa9be54975f0566d6f261a706dcb8d767601d.tar.bz2
[multiple changes]
2011-08-03 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch7.adb (Create_Finalizer): Treat freeze nodes in similar fashion to packages. This ensures that the finalizer body will not end up inside the freeze node. (Process_Declarations): Add code to detect whether a freeze node has a nested finalization collection. 2011-08-03 Pascal Obry <obry@adacore.com> * g-awk.adb, g-awk.ads: Make GNAT.AWK API compatible with Ada 2005. (Current_Session): Return a not null access to Session_Type. (Default_Session): Likewise. From-SVN: r177282
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog14
-rw-r--r--gcc/ada/exp_ch7.adb23
-rw-r--r--gcc/ada/g-awk.adb27
-rw-r--r--gcc/ada/g-awk.ads5
4 files changed, 43 insertions, 26 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 66c9f5ad..f96bc1e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,17 @@
+2011-08-03 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_ch7.adb (Create_Finalizer): Treat freeze nodes in similar fashion
+ to packages. This ensures that the finalizer body will not end up
+ inside the freeze node.
+ (Process_Declarations): Add code to detect whether a freeze node has a
+ nested finalization collection.
+
+2011-08-03 Pascal Obry <obry@adacore.com>
+
+ * g-awk.adb, g-awk.ads: Make GNAT.AWK API compatible with Ada 2005.
+ (Current_Session): Return a not null access to Session_Type.
+ (Default_Session): Likewise.
+
2011-08-03 Robert Dewar <dewar@adacore.com>
* a-cfdlli.adb, bindgen.adb, exp_ch4.adb, exp_ch13.adb, sem_warn.adb,
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 0099269..41dba92 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -1756,10 +1756,12 @@ package body Exp_Ch7 is
Set_Is_Frozen (Fin_Id);
-- In the case where the last construct to contain a controlled
- -- object is either a nested package or instantiation, the body
- -- must be inserted directly after the construct.
+ -- object is either a nested package, an instantiation or a
+ -- freeze node, the body must be inserted directly after the
+ -- construct.
if Nkind_In (Last_Top_Level_Ctrl_Construct,
+ N_Freeze_Entity,
N_Package_Declaration,
N_Package_Body)
then
@@ -1988,7 +1990,24 @@ package body Exp_Ch7 is
(Is_Type (Typ)
and then Needs_Finalization (Typ))
then
+ Old_Counter_Val := Counter_Val;
+
+ -- Freeze nodes are considered to be identical to packages
+ -- and blocks in terms of nesting. The difference is that
+ -- a finalization collection created inside the freeze node
+ -- is at the same nesting level as the node itself.
+
Process_Declarations (Actions (Decl), Preprocess);
+
+ -- The freeze node contains a finalization collection
+
+ if Preprocess
+ and then Top_Level
+ and then No (Last_Top_Level_Ctrl_Construct)
+ and then Counter_Val > Old_Counter_Val
+ then
+ Last_Top_Level_Ctrl_Construct := Decl;
+ end if;
end if;
-- Nested package declarations, avoid generics
diff --git a/gcc/ada/g-awk.adb b/gcc/ada/g-awk.adb
index 36bcca9..f2c934c 100644
--- a/gcc/ada/g-awk.adb
+++ b/gcc/ada/g-awk.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2010, AdaCore --
+-- 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;
--- This is needed because the pragmas Warnings (Off) in Current_Session and
--- Default_Session (see below) do not work when compiling clients of this
--- package that instantiate generic units herein.
-
with Ada.Exceptions;
with Ada.Text_IO;
with Ada.Strings.Unbounded;
@@ -735,30 +730,18 @@ package body GNAT.AWK is
-- 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;
--------------------
diff --git a/gcc/ada/g-awk.ads b/gcc/ada/g-awk.ads
index a8604a7..d6dc83e 100644
--- a/gcc/ada/g-awk.ads
+++ b/gcc/ada/g-awk.ads
@@ -229,12 +229,12 @@ package GNAT.AWK is
-- 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 @@ private
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);