aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/inline.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-12 11:42:31 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-12 11:42:31 +0200
commit92cbddaa2ae10e2cb208067b0fc2871ab81a62bc (patch)
tree99e4763094e799e398df88b7a5f9765b442ca1c8 /gcc/ada/inline.adb
parent718deaf1af8c923d15f417fd3b49ba909c5f26eb (diff)
downloadgcc-92cbddaa2ae10e2cb208067b0fc2871ab81a62bc.zip
gcc-92cbddaa2ae10e2cb208067b0fc2871ab81a62bc.tar.gz
gcc-92cbddaa2ae10e2cb208067b0fc2871ab81a62bc.tar.bz2
[multiple changes]
2010-10-12 Robert Dewar <dewar@adacore.com> * par-endh.adb (Check_End): Don't swallow semicolon or aspects after END RECORD. * sem_attr.adb (Eval_Attribute): Code clean up. 2010-10-12 Robert Dewar <dewar@adacore.com> * par-ch12.adb (P_Formal_Private_Type_Definition): Improve error messages and recovery for case of out of order Abstract/Tagged/Private keywords. * par-ch3.adb (P_Type_Declaration): Improve error messages and recovery for case of out of order Abstract/Tagged/Private keywords. 2010-10-12 Ed Schonberg <schonberg@adacore.com> * inline.adb (Analyze_Inlined_Bodies): Restrict previous change to case where child unit is main unit of compilation. From-SVN: r165354
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r--gcc/ada/inline.adb25
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index f7e2b30..e537144 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -626,19 +626,19 @@ package body Inline is
Pack : Entity_Id;
S : Succ_Index;
- function Is_Ancestor
+ function Is_Ancestor_Of_Main
(U_Name : Entity_Id;
Nam : Node_Id) return Boolean;
-- Determine whether the unit whose body is loaded is an ancestor of
- -- a unit mentioned in a with_clause of that body. The body is not
+ -- the main unit, and has a with_clause on it. The body is not
-- analyzed yet, so the check is purely lexical: the name of the with
-- clause is a selected component, and names of ancestors must match.
- -----------------
- -- Is_Ancestor --
- -----------------
+ -------------------------
+ -- Is_Ancestor_Of_Main --
+ -------------------------
- function Is_Ancestor
+ function Is_Ancestor_Of_Main
(U_Name : Entity_Id;
Nam : Node_Id) return Boolean
is
@@ -649,6 +649,12 @@ package body Inline is
return False;
else
+ if Chars (Selector_Name (Nam)) /=
+ Chars (Cunit_Entity (Main_Unit))
+ then
+ return False;
+ end if;
+
Pref := Prefix (Nam);
if Nkind (Pref) = N_Identifier then
@@ -666,10 +672,10 @@ package body Inline is
else
-- A is an ancestor of A.B.C if it is an ancestor of A.B
- return Is_Ancestor (U_Name, Pref);
+ return Is_Ancestor_Of_Main (U_Name, Pref);
end if;
end if;
- end Is_Ancestor;
+ end Is_Ancestor_Of_Main;
-- Start of processing for Analyze_Inlined_Bodies
@@ -751,7 +757,8 @@ package body Inline is
Item := First (Context_Items (Body_Unit));
while Present (Item) loop
if Nkind (Item) = N_With_Clause
- and then Is_Ancestor (U_Id, Name (Item))
+ and then
+ Is_Ancestor_Of_Main (U_Id, Name (Item))
then
Set_Is_Inlined (U_Id, False);
exit;