diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2011-12-20 13:41:00 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-12-20 14:41:00 +0100 |
commit | 7b2aafc959f1ef24f111eb0d56b393bb2d315bbf (patch) | |
tree | aec132f72b134bbe4292bee0e4444c3592293a72 /gcc/ada/sem_res.adb | |
parent | 9a417f117e8124d6c164f08c4c2c409a291b1622 (diff) | |
download | gcc-7b2aafc959f1ef24f111eb0d56b393bb2d315bbf.zip gcc-7b2aafc959f1ef24f111eb0d56b393bb2d315bbf.tar.gz gcc-7b2aafc959f1ef24f111eb0d56b393bb2d315bbf.tar.bz2 |
sem_res.adb (Resolve_Allocator): Warning on allocation of tasks on a subpool and rewrite the allocator into a...
2011-12-20 Hristian Kirtchev <kirtchev@adacore.com>
* sem_res.adb (Resolve_Allocator): Warning on allocation
of tasks on a subpool and rewrite the allocator into a raise
Program_Error statement.
* s-stposu.ads, s-stposu.adb: Code reformatting.
(Create_Subpool): Remove formal parameter Storage_Size.
(Default_Subpool_For_Pool): Add the default implementation of this
routine.
(Set_Pool_Of_Subpool): Rename formal parameter Pool to To. Update
all the uses of the parameter.
From-SVN: r182533
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r-- | gcc/ada/sem_res.adb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 55a5e36..3a8d7d7 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -4469,23 +4469,26 @@ package body Sem_Res is and then Ekind (Current_Scope) = E_Package and then not In_Package_Body (Current_Scope) then - Error_Msg_N ("cannot activate task before body seen?", N); - Error_Msg_N ("\Program_Error will be raised at run time?", N); + Error_Msg_N ("?cannot activate task before body seen", N); + Error_Msg_N ("\?Program_Error will be raised at run time", N); end if; - -- Ada 2012 (AI05-0111-3): Issue a warning whenever allocating a task - -- or a type containing tasks on a subpool since the deallocation of - -- the subpool may lead to undefined task behavior. Perform the check - -- only when the allocator has not been converted into a Program_Error - -- due to a previous error. + -- Ada 2012 (AI05-0111-3): Detect an attempt to allocate a task or a + -- type with a task component on a subpool. This action must raise + -- Program_Error at runtime. if Ada_Version >= Ada_2012 and then Nkind (N) = N_Allocator and then Present (Subpool_Handle_Name (N)) and then Has_Task (Desig_T) then - Error_Msg_N ("?allocation of task on subpool may lead to " & - "undefined behavior", N); + Error_Msg_N ("?cannot allocate task on subpool", N); + Error_Msg_N ("\?Program_Error will be raised at run time", N); + + Rewrite (N, + Make_Raise_Program_Error (Sloc (N), + Reason => PE_Explicit_Raise)); + Set_Etype (N, Typ); end if; end Resolve_Allocator; |