From 053cf9940a4086500ebaa994d29b894e8f5ed71a Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 15 May 2012 14:04:02 +0200 Subject: [multiple changes] 2012-05-15 Thomas Quinot * exp_ch4.adb (Has_Inferable_Discriminants): For a qualified expression, use correct node for test on the subtype denoted by the subtype mark. 2012-05-15 Eric Botcazou * inline.adb (Scope_In_Main_Unit): Rename into... (In_Main_Unit_Or_Subunit): ...this. Also return true if the subprogram is within a subunit of the main unit. (Add_Inlined_Body): Adjust for above renaming. (Add_Inlined_Subprogram): Likewise. Pass the subprogram directly. (Analyze_Inlined_Bodies): Really set aside inlined subprograms not handled by Add_Inlined_Body. From-SVN: r187528 --- gcc/ada/ChangeLog | 17 +++++++++++++++++ gcc/ada/exp_ch4.adb | 4 ++-- gcc/ada/inline.adb | 38 +++++++++++++++++++++----------------- 3 files changed, 40 insertions(+), 19 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 26bf104..a68c95c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2012-05-15 Thomas Quinot + + * exp_ch4.adb (Has_Inferable_Discriminants): For a qualified + expression, use correct node for test on the subtype denoted by + the subtype mark. + +2012-05-15 Eric Botcazou + + * inline.adb (Scope_In_Main_Unit): Rename into... + (In_Main_Unit_Or_Subunit): ...this. Also return + true if the subprogram is within a subunit of the + main unit. + (Add_Inlined_Body): Adjust for above renaming. + (Add_Inlined_Subprogram): Likewise. Pass the subprogram directly. + (Analyze_Inlined_Bodies): Really set aside inlined subprograms + not handled by Add_Inlined_Body. + 2012-05-15 Ed Schonberg * sem_ch10.adb (Expand_With_Clause): In the context of a generic diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 03ab119..69c483a 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -10105,9 +10105,9 @@ package body Exp_Ch4 is -- mark is a constrained Unchecked_Union subtype. elsif Nkind (N) = N_Qualified_Expression then - return Is_Unchecked_Union (Subtype_Mark (N)) + return Is_Unchecked_Union (Etype (Subtype_Mark (N))) and then - Is_Constrained (Subtype_Mark (N)); + Is_Constrained (Etype (Subtype_Mark (N))); end if; diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 86d2fdf..2c84992 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -138,8 +138,8 @@ package body Inline is -- Return the entity node for the unit containing E. Always return -- the spec for a package. - function Scope_In_Main_Unit (Scop : Entity_Id) return Boolean; - -- Return True if Scop is in the main unit or its spec + function In_Main_Unit_Or_Subunit (E : Entity_Id) return Boolean; + -- Return True if E is in the main unit or its spec or in a subunit procedure Add_Call (Called : Entity_Id; Caller : Entity_Id := Empty); -- Make two entries in Inlined table, for an inlined subprogram being @@ -341,7 +341,7 @@ package body Inline is elsif not Is_Inlined (Pack) and then Comes_From_Source (E) - and then not Scope_In_Main_Unit (Pack) + and then not In_Main_Unit_Or_Subunit (Pack) then Set_Is_Inlined (Pack); Inlined_Bodies.Increment_Last; @@ -433,7 +433,7 @@ package body Inline is and then (Is_Inlined (Pack) or else Is_Generic_Instance (Pack) or else Is_Internal (E)) - and then not Scope_In_Main_Unit (Pack) + and then not In_Main_Unit_Or_Subunit (E) and then not Is_Nested (E) and then not Has_Initialized_Type (E) then @@ -746,7 +746,7 @@ package body Inline is -- This means that Add_Inlined_Body added the subprogram to the -- table but wasn't able to handle its code unit. Do nothing. - null; + Inlined.Table (Index).Processed := True; elsif Inlined.Table (Index).Main_Call then Pending_Inlined.Increment_Last; Pending_Inlined.Table (Pending_Inlined.Last) := Index; @@ -767,9 +767,9 @@ package body Inline is while S /= No_Succ loop Subp := Successors.Table (S).Subp; - Set_Is_Called (Inlined.Table (Subp).Name); if not Inlined.Table (Subp).Processed then + Set_Is_Called (Inlined.Table (Subp).Name); Pending_Inlined.Increment_Last; Pending_Inlined.Table (Pending_Inlined.Last) := Subp; Inlined.Table (Subp).Processed := True; @@ -1156,23 +1156,27 @@ package body Inline is end loop; end Remove_Dead_Instance; - ------------------------ - -- Scope_In_Main_Unit -- - ------------------------ + ----------------------------- + -- In_Main_Unit_Or_Subunit -- + ----------------------------- - function Scope_In_Main_Unit (Scop : Entity_Id) return Boolean is - Comp : constant Node_Id := Cunit (Get_Code_Unit (Scop)); + function In_Main_Unit_Or_Subunit (E : Entity_Id) return Boolean is + Comp : Node_Id := Cunit (Get_Code_Unit (E)); begin - -- Check whether the scope of the subprogram to inline is within the - -- main unit or within its spec. In either case there are no additional - -- bodies to process. If the subprogram appears in a parent of the - -- current unit, the check on whether inlining is possible is done in - -- Analyze_Inlined_Bodies. + -- Check whether the subprogram or package to inline is within the main + -- unit or its spec or within a subunit. In either case there are no + -- additional bodies to process. If the subprogram appears in a parent + -- of the current unit, the check on whether inlining is possible is + -- done in Analyze_Inlined_Bodies. + + while Nkind (Unit (Comp)) = N_Subunit loop + Comp := Library_Unit (Comp); + end loop; return Comp = Cunit (Main_Unit) or else Comp = Library_Unit (Cunit (Main_Unit)); - end Scope_In_Main_Unit; + end In_Main_Unit_Or_Subunit; end Inline; -- cgit v1.1