OSDN Git Service

PR bootstrap/11932
[pf3gnuchains/gcc-fork.git] / gcc / ada / exp_ch6.adb
index 6a54343..744a024 100644 (file)
@@ -51,6 +51,7 @@ with Nlists;   use Nlists;
 with Nmake;    use Nmake;
 with Opt;      use Opt;
 with Restrict; use Restrict;
+with Rident;   use Rident;
 with Rtsfind;  use Rtsfind;
 with Sem;      use Sem;
 with Sem_Ch6;  use Sem_Ch6;
@@ -358,7 +359,7 @@ package body Exp_Ch6 is
       --  since we won't be able to generate the code to handle the
       --  recursion in any case.
 
-      if Restrictions (No_Implicit_Conditionals) then
+      if Restriction_Active (No_Implicit_Conditionals) then
          return;
       end if;
 
@@ -595,6 +596,10 @@ package body Exp_Ch6 is
                Init :=
                  Convert_To (Etype (Formal), New_Occurrence_Of (Var, Loc));
             end if;
+
+         elsif Ekind (Formal) = E_In_Parameter then
+            Init := New_Occurrence_Of (Var, Loc);
+
          else
             Init := Empty;
          end if;
@@ -1265,7 +1270,7 @@ package body Exp_Ch6 is
          --  if we can tell that the first parameter cannot possibly be null.
          --  This helps optimization and also generation of warnings.
 
-         if not Restrictions (No_Exception_Handlers)
+         if not Restriction_Active (No_Exception_Handlers)
            and then Is_RTE (Subp, RE_Raise_Exception)
          then
             declare
@@ -1914,12 +1919,43 @@ package body Exp_Ch6 is
       then
          if Is_Inlined (Subp) then
 
-            declare
+            Inlined_Subprogram : declare
                Bod         : Node_Id;
                Must_Inline : Boolean := False;
                Spec        : constant Node_Id := Unit_Declaration_Node (Subp);
                Scop        : constant Entity_Id := Scope (Subp);
 
+               function In_Unfrozen_Instance return Boolean;
+               --  If the subprogram comes from an instance in the same
+               --  unit, and the instance is not yet frozen, inlining might
+               --  trigger order-of-elaboration problems in gigi.
+
+               --------------------------
+               -- In_Unfrozen_Instance --
+               --------------------------
+
+               function In_Unfrozen_Instance return Boolean is
+                  S : Entity_Id := Scop;
+
+               begin
+                  while Present (S)
+                    and then S /= Standard_Standard
+                  loop
+                     if Is_Generic_Instance (S)
+                       and then Present (Freeze_Node (S))
+                       and then not Analyzed (Freeze_Node (S))
+                     then
+                        return True;
+                     end if;
+
+                     S := Scope (S);
+                  end loop;
+
+                  return False;
+               end In_Unfrozen_Instance;
+
+            --  Start of processing for Inlined_Subprogram
+
             begin
                --  Verify that the body to inline has already been seen,
                --  and that if the body is in the current unit the inlining
@@ -1942,14 +1978,7 @@ package body Exp_Ch6 is
                then
                   Must_Inline := False;
 
-               --  If the subprogram comes from an instance in the same
-               --  unit, and the instance is not yet frozen, inlining might
-               --  trigger order-of-elaboration problems in gigi.
-
-               elsif Is_Generic_Instance (Scop)
-                 and then Present (Freeze_Node (Scop))
-                 and then not Analyzed (Freeze_Node (Scop))
-               then
+               elsif In_Unfrozen_Instance then
                   Must_Inline := False;
 
                else
@@ -1997,7 +2026,7 @@ package body Exp_Ch6 is
                        N, Subp);
                   end if;
                end if;
-            end;
+            end Inlined_Subprogram;
          end if;
       end if;
 
@@ -3004,7 +3033,7 @@ package body Exp_Ch6 is
 
          --  Create new exception handler
 
-         if Restrictions (No_Exception_Handlers) then
+         if Restriction_Active (No_Exception_Handlers) then
             Excep_Handlers := No_List;
 
          else