aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2011-08-29 08:55:18 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-29 10:55:18 +0200
commit7f394c1d9bbd3a480f4abfbc0aca8a4e755211a8 (patch)
treef800b935551ef86b82d80222dcee41567552a48c /gcc
parent304fe432e55a7dffc0a7f9ceaedce48345ba7a5d (diff)
downloadgcc-7f394c1d9bbd3a480f4abfbc0aca8a4e755211a8.zip
gcc-7f394c1d9bbd3a480f4abfbc0aca8a4e755211a8.tar.gz
gcc-7f394c1d9bbd3a480f4abfbc0aca8a4e755211a8.tar.bz2
gnat_rm.texi: Add doc for 'Elab_Subp_Body.
2011-08-29 Arnaud Charlet <charlet@adacore.com> * gnat_rm.texi: Add doc for 'Elab_Subp_Body. * bindgen.adb: Add comments. * snames.adb-tmpl (Is_Attribute_Name): Only recognize 'Elab_Subp_Body in CodePeer mode. From-SVN: r178168
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/bindgen.adb17
-rw-r--r--gcc/ada/gnat_rm.texi13
-rw-r--r--gcc/ada/snames.adb-tmpl3
4 files changed, 36 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 7e04f40..a9551c7 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-29 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat_rm.texi: Add doc for 'Elab_Subp_Body.
+ * bindgen.adb: Add comments.
+ * snames.adb-tmpl (Is_Attribute_Name): Only recognize 'Elab_Subp_Body
+ in CodePeer mode.
+
2011-08-29 Robert Dewar <dewar@adacore.com>
* exp_attr.adb: Minor reformatting.
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index 6e0d5bd..8d40273 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -984,11 +984,15 @@ 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
and then (not CodePeer_Mode
- or else U.Utype = Is_Spec
- or else U.Utype = Is_Spec_Only
- or else U.Unit_Kind /= 's')
+ or else U.Utype = Is_Spec
+ or else U.Utype = Is_Spec_Only
+ or else U.Unit_Kind /= 's')
then
-- The only case in which we have to do something is if this
@@ -1024,6 +1028,9 @@ package body Bindgen is
-- The uname_E increment is skipped if this is a separate spec,
-- since it will be done when we process the body.
+ -- In CodePeer mode, we do not generate any reference to xxx_E
+ -- variables, only calls to 'Elab* subprograms.
+
else
Check_Elab_Flag :=
not CodePeer_Mode
@@ -1059,6 +1066,10 @@ package body Bindgen is
"'elab_spec";
Name_Len := Name_Len + 8;
+ -- Special case in CodePeer mode for subprogram bodies
+ -- which correspond to CodePeer 'Elab_Subp_Body special
+ -- init procedure.
+
elsif U.Unit_Kind = 's' and CodePeer_Mode then
Name_Buffer (Name_Len - 1 .. Name_Len + 13) :=
"'elab_subp_body";
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index a7f13a1..803f210 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -239,6 +239,7 @@ Implementation Defined Attributes
* Elaborated::
* Elab_Body::
* Elab_Spec::
+* Elab_Subp_Body::
* Emax::
* Enabled::
* Enum_Rep::
@@ -5719,6 +5720,7 @@ consideration, you should minimize the use of these attributes.
* Elaborated::
* Elab_Body::
* Elab_Spec::
+* Elab_Subp_Body::
* Emax::
* Enabled::
* Enum_Rep::
@@ -5966,6 +5968,17 @@ which it is useful to be able to call this elaboration procedure from
Ada code, e.g.@: if it is necessary to do selective re-elaboration to fix
some error.
+@node Elab_Subp_Body
+@unnumberedsec Elab_Subp_Body
+@findex Elab_Subp_Body
+@noindent
+This attribute can only be applied to a library level subprogram
+name and is only allowed in CodePeer mode. It returns the entity
+for the corresponding elaboration procedure for elaborating the body
+of the referenced subprogram unit. This is used in the main generated
+elaboration procedure by the binder in CodePeer mode only and is unrecognized
+otherwise.
+
@node Emax
@unnumberedsec Emax
@cindex Ada 83 attributes
diff --git a/gcc/ada/snames.adb-tmpl b/gcc/ada/snames.adb-tmpl
index defe949..92b258d 100644
--- a/gcc/ada/snames.adb-tmpl
+++ b/gcc/ada/snames.adb-tmpl
@@ -306,7 +306,8 @@ package body Snames is
function Is_Attribute_Name (N : Name_Id) return Boolean is
begin
- return N in First_Attribute_Name .. Last_Attribute_Name;
+ return N in First_Attribute_Name .. Last_Attribute_Name
+ and then (CodePeer_Mode or else N /= Name_Elab_Subp_Body);
end Is_Attribute_Name;
----------------------------------