[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 18 Jun 2010 19:48:43 +0000 (21:48 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 18 Jun 2010 19:48:43 +0000 (21:48 +0200)
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

gcc/ada/ChangeLog
gcc/ada/debug.adb
gcc/ada/freeze.adb
gcc/ada/s-tpoben.adb

index ef18f42..965e7b2 100644 (file)
@@ -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.
index 5f7f26b..b7f750d 100644 (file)
@@ -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
index 2897307..e69bb76 100644 (file)
@@ -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);
index 4694310..ba2bf6c 100644 (file)
@@ -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);