diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-17 07:04:32 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-17 07:04:32 +0000 |
commit | ce4c4c3bf8654bf485b66a252b9ea12def04b312 (patch) | |
tree | 352d2db8f4189df2df675f4be0af31df5b8b4d3a /gcc/ada/bindgen.adb | |
parent | 199ab4c36db38a75d5d1cb9361ac80bd27e9164d (diff) | |
download | gcc-ce4c4c3bf8654bf485b66a252b9ea12def04b312.tar.gz |
2014-07-17 Robert Dewar <dewar@adacore.com>
* bindgen.adb (Gen_Elab_Calls): Skip reference to elab
entity if none exists (Gen_Elab_Calls): Complain if clash with
No_Multiple_Elaboration.
* s-rident.ads, restrict.ads: Add restriction No_Multiple_Elaboration.
* sem_util.adb (Build_Elaboration_Entity): Skip building entity
if not needed.
* gnat_rm.texi: Document restriction No_Multiple_Elaboration.
* sem_ch4.adb: Minor comment updates.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212735 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/bindgen.adb')
-rw-r--r-- | gcc/ada/bindgen.adb | 59 |
1 files changed, 47 insertions, 12 deletions
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index 270aa5e07b6..a192953fbbc 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, 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- -- @@ -1068,6 +1068,8 @@ package body Bindgen is Check_Elab_Flag : Boolean; begin + -- Loop through elaboration order entries + for E in Elab_Order.First .. Elab_Order.Last loop declare Unum : constant Unit_Id := Elab_Order.Table (E); @@ -1098,20 +1100,23 @@ package body Bindgen is -- Case of no elaboration code - -- In CodePeer mode, we special case subprogram bodies which - -- are handled in the 'else' part below, and lead to a call to - -- <subp>'Elab_Subp_Body. - elsif U.No_Elab + + -- In CodePeer mode, we special case subprogram bodies which + -- are handled in the 'else' part below, and lead to a call + -- to <subp>'Elab_Subp_Body. + and then (not CodePeer_Mode + + -- Test for spec + or else U.Utype = Is_Spec or else U.Utype = Is_Spec_Only or else U.Unit_Kind /= 's') then - -- In the case of a body with a separate spec, where the -- separate spec has an elaboration entity defined, this is - -- where we increment the elaboration entity. + -- where we increment the elaboration entity if one exists if U.Utype = Is_Body and then Units.Table (Unum_Spec).Set_Elab_Entity @@ -1142,8 +1147,7 @@ package body Bindgen is -- a spec with a body, the elaboration entity is initialized -- here. This is done because it's the only way to accomplish -- initialization of such entities, as there is no mechanism - -- provided for initializing global variables at load time on - -- AAMP. + -- for load time global variable initialization on AAMP. elsif AAMP_On_Target and then U.Utype = Is_Spec @@ -1179,8 +1183,7 @@ package body Bindgen is -- a spec with a body, the elaboration entity is initialized -- here. This is done because it's the only way to accomplish -- initialization of such entities, as there is no mechanism - -- provided for initializing global variables at load time on - -- AAMP. + -- for load time global variable initialization on AAMP. if AAMP_On_Target and then U.Utype = Is_Spec @@ -1192,8 +1195,39 @@ package body Bindgen is Write_Statement_Buffer; end if; + -- Check incompatibilities with No_Multiple_Elaboration + + if not CodePeer_Mode + and then Cumulative_Restrictions.Set (No_Multiple_Elaboration) + then + -- Force_Checking_Of_Elaboration_Flags (-F) not allowed + + if Force_Checking_Of_Elaboration_Flags then + Osint.Fail + ("-F (force elaboration checks) switch not allowed " + & "with restriction No_Multiple_Elaboration active"); + + -- Interfacing of libraries not allowed + + elsif Interface_Library_Unit then + Osint.Fail + ("binding of interfaced libraries not allowed " + & "with restriction No_Multiple_Elaboration active"); + + -- Non-Ada main program not allowed + + elsif not Bind_Main_Program then + Osint.Fail + ("non-Ada main program not allowed " + & "with restriction No_Multiple_Elaboration active"); + end if; + end if; + + -- OK, see if we need to test elaboration flag + Check_Elab_Flag := - not CodePeer_Mode + Units.Table (Unum_Spec).Set_Elab_Entity + and then not CodePeer_Mode and then (Force_Checking_Of_Elaboration_Flags or Interface_Library_Unit or not Bind_Main_Program); @@ -1253,6 +1287,7 @@ package body Bindgen is if U.Utype /= Is_Spec and then not CodePeer_Mode + and then Units.Table (Unum_Spec).Set_Elab_Entity then Set_String (" E"); Set_Unit_Number (Unum_Spec); |