summaryrefslogtreecommitdiff
path: root/gcc/ada/inline.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-06 10:52:32 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-06 10:52:32 +0000
commit59ca7bac23b6b53257582966f19a3e84ea0138a2 (patch)
tree162a23fa1dc6b2cfca448b3db6905b462f282b70 /gcc/ada/inline.adb
parent115a8ff95a7b32496cbaf73f390aaaa335b5501e (diff)
downloadgcc-59ca7bac23b6b53257582966f19a3e84ea0138a2.tar.gz
2007-04-20 Robert Dewar <dewar@adacore.com>
* a-reatim.adb: Documentation addition * g-cgideb.adb: Minor code reorganization * tree_io.adb, treepr.adb, cstand.adb, krunch.adb, par.adb, mdll-utl.adb, par-ch5.adb, par-tchk.adb, s-exctab.ads, s-memory.ads, s-osprim.ads, s-restri.ads, s-soflin.ads: Minor reformatting. * debug.ads, debug.adb (Get_Debug_Flag_K): Remove unused obsolete function. Change name New_Scope to Push_Scope (Get_Debug_Flag_K): Remove unused obsolete function. * exp_ch8.adb, inline.adb, sem_ch8.ads: Change name New_Scope to Push_Scope. * makeusg.adb: Update Copyright notice Add line for switch -aP * makeusg.adb: Fix wording of some usage messages * s-assert.adb (Raise_Assert_Failure): Add call to Debug_Raise_Assert_Failure. * s-unstyp.ads (type Packed_Bytes2): Change alignment to use 'Min (2, Standard'Alignment) for compatibility with AAMP (where alignment is restricted to 1). * s-wchjis.adb: Remove use of System.Pure_Exceptions * tbuild.ads, tbuild.adb (Make_Implicit_Exception_Handler): Set the node location to No_Location when we're not debugging the expanded code. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125478 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r--gcc/ada/inline.adb30
1 files changed, 20 insertions, 10 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index f39bbbaf344..c9b43ba187c 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -33,6 +33,7 @@ with Exp_Tss; use Exp_Tss;
with Fname; use Fname;
with Fname.UF; use Fname.UF;
with Lib; use Lib;
+with Namet; use Namet;
with Nlists; use Nlists;
with Opt; use Opt;
with Sem_Ch8; use Sem_Ch8;
@@ -246,12 +247,24 @@ package body Inline is
-----------------
function Must_Inline return Boolean is
- Scop : Entity_Id := Current_Scope;
+ Scop : Entity_Id;
Comp : Node_Id;
begin
-- Check if call is in main unit
+ Scop := Current_Scope;
+
+ -- Do not try to inline if scope is standard. This could happen, for
+ -- example, for a call to Add_Global_Declaration, and it causes
+ -- trouble to try to inline at this level.
+
+ if Scop = Standard_Standard then
+ return False;
+ end if;
+
+ -- Otherwise lookup scope stack to outer scope
+
while Scope (Scop) /= Standard_Standard
and then not Is_Child_Unit (Scop)
loop
@@ -259,7 +272,6 @@ package body Inline is
end loop;
Comp := Parent (Scop);
-
while Nkind (Comp) /= N_Compilation_Unit loop
Comp := Parent (Comp);
end loop;
@@ -271,8 +283,7 @@ package body Inline is
return True;
end if;
- -- Call is not in main unit. See if it's in some inlined
- -- subprogram.
+ -- Call is not in main unit. See if it's in some inlined subprogram
Scop := Current_Scope;
while Scope (Scop) /= Standard_Standard
@@ -289,7 +300,6 @@ package body Inline is
end loop;
return False;
-
end Must_Inline;
-- Start of processing for Add_Inlined_Body
@@ -563,7 +573,7 @@ package body Inline is
Analyzing_Inlined_Bodies := False;
if Serious_Errors_Detected = 0 then
- New_Scope (Standard_Standard);
+ Push_Scope (Standard_Standard);
J := 0;
while J <= Inlined_Bodies.Last
@@ -609,7 +619,7 @@ package body Inline is
Error_Msg_N
("one or more inlined subprograms accessed in $!",
Comp_Unit);
- Error_Msg_Name_1 :=
+ Error_Msg_File_1 :=
Get_File_Name (Bname, Subunit => False);
Error_Msg_N ("\but file{ was not found!", Comp_Unit);
raise Unrecoverable_Error;
@@ -860,7 +870,7 @@ package body Inline is
end if;
end if;
- New_Scope (Scop);
+ Push_Scope (Scop);
Expand_Cleanup_Actions (Decl);
End_Scope;
@@ -935,7 +945,7 @@ package body Inline is
if Serious_Errors_Detected = 0 then
Expander_Active := (Operating_Mode = Opt.Generate_Code);
- New_Scope (Standard_Standard);
+ Push_Scope (Standard_Standard);
To_Clean := New_Elmt_List;
if Is_Generic_Unit (Cunit_Entity (Main_Unit)) then