summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch12.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-17 16:07:56 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-17 16:07:56 +0000
commit381236ec8eb5cbda0dbd543cdd3473a07c748d09 (patch)
tree22857c8b90ddc128484ae3c5bb9f701de7c64a2e /gcc/ada/sem_ch12.adb
parent31a6ceccc1cf108b2598a0744845b8f6a7347b3d (diff)
downloadgcc-381236ec8eb5cbda0dbd543cdd3473a07c748d09.tar.gz
2006-02-17 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Analyze_Package_Instantiation): Inline_Now is false if the current instance is nested within another instance in a child unit. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111192 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch12.adb')
-rw-r--r--gcc/ada/sem_ch12.adb28
1 files changed, 18 insertions, 10 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index ba3cc95d9c4..9b9313cacfc 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -2710,16 +2710,24 @@ package body Sem_Ch12 is
end if;
-- If the current scope is itself an instance within a child
- -- unit, and that unit itself is not an instance, it is
- -- duplicated in the scope stack, and the unstacking mechanism
- -- in Inline_Instance_Body will fail. This loses some rare
- -- cases of optimization, and might be improved some day ????
-
- if Is_Generic_Instance (Current_Scope)
- and then Is_Child_Unit (Scope (Current_Scope))
- and then not Is_Generic_Instance (Scope (Current_Scope))
- then
- Inline_Now := False;
+ -- unit,there will be duplications in the scope stack, and the
+ -- unstacking mechanism in Inline_Instance_Body will fail.
+ -- This loses some rare cases of optimization, and might be
+ -- improved some day, if we can find a proper abstraction for
+ -- "the complete compilation context" that can be saved and
+ -- restored ???
+
+ if Is_Generic_Instance (Current_Scope) then
+ declare
+ Curr_Unit : constant Entity_Id :=
+ Cunit_Entity (Current_Sem_Unit);
+ begin
+ if Curr_Unit /= Current_Scope
+ and then Is_Child_Unit (Curr_Unit)
+ then
+ Inline_Now := False;
+ end if;
+ end;
end if;
end if;