summaryrefslogtreecommitdiff
path: root/gcc/ada/bcheck.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-08 12:54:03 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-08 12:54:03 +0000
commitcb536df04f56c2ffd9f5abdf52a39f60f2bdfd31 (patch)
tree2a0cb37f03e0c50944d29b876561a756b303f1f9 /gcc/ada/bcheck.adb
parent8e4cad12e963d1a7d09f22a6520ad16a0782d6e7 (diff)
downloadgcc-cb536df04f56c2ffd9f5abdf52a39f60f2bdfd31.tar.gz
2010-10-08 Robert Dewar <dewar@adacore.com>
* ali.adb: Set Allocator_In_Body if AB parameter present on M line * ali.ads (Allocator_In_Body): New flag * bcheck.adb (Check_Consistent_Restrictions): Handle case of main program violating No_Allocators_After_Elaboration restriction. * gnatbind.adb (No_Restriction_List): Add entries for No_Anonymous_Allocators, and No_Allocators_After_Elaboration. * lib-load.adb: Initialize Has_Allocator flag * lib-writ.adb: Initialize Has_Allocator flag (M_Parameters): Set AB switch if Has_Allocator flag set * lib-writ.ads: Document AB flag on M line * lib.adb (Has_Allocator): New function (Set_Has_Allocator): New procedure * lib.ads (Has_Allocator): New function (Set_Has_Allocator): New procedure (Has_Allocator): New flag in Unit_Record * sem_ch4.adb (Analyze_Allocator): Add processing for No_Allocators_After_Elaboration. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165171 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/bcheck.adb')
-rw-r--r--gcc/ada/bcheck.adb18
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb
index 084ce199dda..796627e0d52 100644
--- a/gcc/ada/bcheck.adb
+++ b/gcc/ada/bcheck.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, 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- --
@@ -854,6 +854,22 @@ package body Bcheck is
-- Start of processing for Check_Consistent_Restrictions
begin
+ -- A special test, if we have a main program, then if it has an
+ -- allocator in the body, this is considered to be a violation of
+ -- the restriction No_Allocators_After_Elaboration. We just mark
+ -- this restriction and then the normal circuit will flag it.
+
+ if Bind_Main_Program
+ and then ALIs.Table (ALIs.First).Main_Program /= None
+ and then not No_Main_Subprogram
+ and then ALIs.Table (ALIs.First).Allocator_In_Body
+ then
+ Cumulative_Restrictions.Violated
+ (No_Allocators_After_Elaboration) := True;
+ ALIs.Table (ALIs.First).Restrictions.Violated
+ (No_Allocators_After_Elaboration) := True;
+ end if;
+
-- Loop through all restriction violations
for R in All_Restrictions loop