From a7db85059646becbe96ef4a2c4b4388e66a5775c Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 31 Oct 2006 17:48:46 +0000 Subject: 2006-10-31 Bob Duff * 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 --- gcc/ada/s-finimp.ads | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'gcc/ada/s-finimp.ads') 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. -- cgit v1.2.1