summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-06-18 21:48:43 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-18 21:48:43 +0200
commitca0cb93e349680470ab76b29525e63f6f8dd3ba5 (patch)
treef025f60bafaee20c328c94c38e321e219aa0b1b5
parentdc2cf706b84723741ca863f04fcfde3834e60747 (diff)
downloadgcc-ca0cb93e349680470ab76b29525e63f6f8dd3ba5.tar.gz
[multiple changes]
2010-06-18 Ed Schonberg <schonberg@adacore.com> * freeze.adb (Build_And_Analyze_Renamed_Body): If the renaming declaration appears in the same unit and ealier than the renamed entity, retain generated body to prevent order-of-elaboration issues in gigi. 2010-06-18 Arnaud Charlet <charlet@adacore.com> * s-tpoben.adb: Update comments. 2010-06-18 Robert Dewar <dewar@adacore.com> * debug.adb: Minor comment change. From-SVN: r161010
-rw-r--r--gcc/ada/ChangeLog15
-rw-r--r--gcc/ada/debug.adb6
-rw-r--r--gcc/ada/freeze.adb37
-rw-r--r--gcc/ada/s-tpoben.adb10
4 files changed, 48 insertions, 20 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ef18f42cf69..965e7b2f450 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,18 @@
+2010-06-18 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Build_And_Analyze_Renamed_Body): If the renaming
+ declaration appears in the same unit and ealier than the renamed
+ entity, retain generated body to prevent order-of-elaboration issues in
+ gigi.
+
+2010-06-18 Arnaud Charlet <charlet@adacore.com>
+
+ * s-tpoben.adb: Update comments.
+
+2010-06-18 Robert Dewar <dewar@adacore.com>
+
+ * debug.adb: Minor comment change.
+
2010-06-18 Javier Miranda <miranda@adacore.com>
* exp_cg.adb: Code clean up.
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index 5f7f26b0723..b7f750d506f 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -597,8 +597,10 @@ package body Debug is
-- scheme has problems.
-- d.Z This flag enables the frontend call-graph output associated with
- -- dispatching calls. Available only during the development of this
- -- new output.
+ -- dispatching calls. This is a temporary debug flag to be used during
+ -- development of this output. Once it works, it will always be output
+ -- (as part of the standard call-graph output) by default, and this
+ -- flag will be removed.
-- d1 Error messages have node numbers where possible. Normally error
-- messages have only source locations. This option is useful when
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 289730704cd..e69bb765f04 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -36,6 +36,7 @@ with Exp_Pakd; use Exp_Pakd;
with Exp_Util; use Exp_Util;
with Exp_Tss; use Exp_Tss;
with Layout; use Layout;
+with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
@@ -203,32 +204,42 @@ package body Freeze is
New_S : Entity_Id;
After : in out Node_Id)
is
- Body_Node : Node_Id;
- Intr : Entity_Id;
- Body_Decl : constant Node_Id := Unit_Declaration_Node (New_S);
- Ent : constant Entity_Id := Defining_Entity (Decl);
+ Body_Decl : constant Node_Id := Unit_Declaration_Node (New_S);
+ Ent : constant Entity_Id := Defining_Entity (Decl);
+ Body_Node : Node_Id;
+ Renamed_Subp : Entity_Id;
begin
-- if the renamed subprogram is intrinsic, there is no need for a
-- wrapper body: we set the alias that will be called and expanded
- -- which completes the declaration.
+ -- which completes the declaration. This transformation is only
+ -- legal if the renamed entity has already been elaborated.
+
-- Note that it is legal for a renaming_as_body to rename an intrinsic
-- subprogram, as long as the renaming occurs before the new entity
-- is frozen. See RM 8.5.4 (5).
if Nkind (Body_Decl) = N_Subprogram_Renaming_Declaration
and then Is_Entity_Name (Name (Body_Decl))
- and then Is_Intrinsic_Subprogram (Entity (Name (Body_Decl)))
- and then Present (Interface_Name (Entity (Name (Body_Decl))))
then
- Intr := Entity (Name (Body_Decl));
- Set_Interface_Name
- (Intr, Interface_Name (Entity (Name (Body_Decl))));
- if Present (Alias (Intr)) then
- Set_Alias (Ent, Alias (Intr));
+ Renamed_Subp := Entity (Name (Body_Decl));
+ else
+ Renamed_Subp := Empty;
+ end if;
+
+ if Present (Renamed_Subp)
+ and then Is_Intrinsic_Subprogram (Renamed_Subp)
+ and then Present (Interface_Name (Renamed_Subp))
+ and then
+ (not In_Same_Source_Unit (Renamed_Subp, Ent)
+ or else Sloc (Renamed_Subp) < Sloc (Ent))
+ then
+ Set_Interface_Name (Ent, Interface_Name (Renamed_Subp));
+ if Present (Alias (Renamed_Subp)) then
+ Set_Alias (Ent, Alias (Renamed_Subp));
else
- Set_Alias (Ent, Intr);
+ Set_Alias (Ent, Renamed_Subp);
end if;
Set_Is_Intrinsic_Subprogram (Ent);
diff --git a/gcc/ada/s-tpoben.adb b/gcc/ada/s-tpoben.adb
index 4694310ebff..ba2bf6c267a 100644
--- a/gcc/ada/s-tpoben.adb
+++ b/gcc/ada/s-tpoben.adb
@@ -226,12 +226,12 @@ package body System.Tasking.Protected_Objects.Entries is
raise Program_Error;
end if;
- -- pragma Assert (Self_Id.Deferral_Level = 0);
-- If a PO is created from a controlled operation, abort is already
- -- deferred at this point, so we need to use Defer_Abort_Nestable
- -- In some cases, the above assertion can be useful to spot
- -- inconsistencies, outside the above scenario involving controlled
- -- types.
+ -- deferred at this point, so we need to use Defer_Abort_Nestable. In
+ -- some cases, the following assertion can help to spot inconsistencies,
+ -- outside the above scenario involving controlled types.
+
+ -- pragma Assert (Self_Id.Deferral_Level = 0);
Initialization.Defer_Abort_Nestable (Self_ID);
Initialize_Lock (Init_Priority, Object.L'Access);