summaryrefslogtreecommitdiff
path: root/gcc/ada/s-finimp.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 17:48:46 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-31 17:48:46 +0000
commita7db85059646becbe96ef4a2c4b4388e66a5775c (patch)
tree37928a22f575da602c9aae71b599087c658ace97 /gcc/ada/s-finimp.ads
parente2c62f37a8c0421e1e135e446b08f871db1d4596 (diff)
downloadgcc-a7db85059646becbe96ef4a2c4b4388e66a5775c.tar.gz
2006-10-31 Bob Duff <duff@adacore.com>
* a-filico.adb (Finalize(List_Controller)): Mark the finalization list as finalization-started, so we can raise Program_Error on 'new'. * s-finimp.adb: Raise Program_Error on 'new' if finalization of the collection has already started. * s-finimp.ads (Collection_Finalization_Started): Added new special flag value for indicating that a collection's finalization has started. * s-tassta.adb (Create_Task): Raise Program_Error on an attempt to create a task whose master has already waited for dependent tasks. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118241 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-finimp.ads')
-rw-r--r--gcc/ada/s-finimp.ads21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ada/s-finimp.ads b/gcc/ada/s-finimp.ads
index 83d1709b6a8..8366e956c99 100644
--- a/gcc/ada/s-finimp.ads
+++ b/gcc/ada/s-finimp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006 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- --
@@ -31,17 +31,36 @@
-- --
------------------------------------------------------------------------------
+with Ada.Unchecked_Conversion;
+
+with System.Storage_Elements;
with System.Finalization_Root;
package System.Finalization_Implementation is
pragma Elaborate_Body;
+ package SSE renames System.Storage_Elements;
package SFR renames System.Finalization_Root;
------------------------------------------------
-- Finalization Management Abstract Interface --
------------------------------------------------
+ function To_Finalizable_Ptr is new Ada.Unchecked_Conversion
+ (Source => System.Address, Target => SFR.Finalizable_Ptr);
+
+ Collection_Finalization_Started : constant SFR.Finalizable_Ptr :=
+ To_Finalizable_Ptr (SSE.To_Address (1));
+ -- This is used to implement the rule in RM-4.8(10.2/2) that requires an
+ -- allocator to raise Program_Error if the collection finalization has
+ -- already started. See also Ada.Finalization.List_Controller. Finalize on
+ -- List_Controller first sets the list to Collection_Finalization_Started,
+ -- to indicate that finalization has started. An allocator will call
+ -- Attach_To_Final_List, which checks for the special value and raises
+ -- Program_Error if appropriate. The value of
+ -- Collection_Finalization_Started must be different from 'Access of any
+ -- finalizable object, and different from null. See AI-280.
+
Global_Final_List : SFR.Finalizable_Ptr;
-- This list stores the controlled objects defined in library-level
-- packages. They will be finalized after the main program completion.