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;
-- 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;
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;
-- 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
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
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
N, Subp);
end if;
end if;
- end;
+ end Inlined_Subprogram;
end if;
end if;
-- Create new exception handler
- if Restrictions (No_Exception_Handlers) then
+ if Restriction_Active (No_Exception_Handlers) then
Excep_Handlers := No_List;
else