aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_prag.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-05-19 16:24:07 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2004-05-19 16:24:07 +0200
commitc37bb106ec37b73a1d44494a268f5857a2b90b93 (patch)
treea57faeaf8a7a0c6e7070868d587ca81339b04831 /gcc/ada/sem_prag.adb
parent31a52b868a209f0c8f3ade10a91148664526dc9b (diff)
downloadgcc-c37bb106ec37b73a1d44494a268f5857a2b90b93.zip
gcc-c37bb106ec37b73a1d44494a268f5857a2b90b93.tar.gz
gcc-c37bb106ec37b73a1d44494a268f5857a2b90b93.tar.bz2
[multiple changes]
2004-05-19 Joel Brobecker <brobecker@gnat.com> * exp_dbug.ads: Correct comments concerning handling of overloading, since we no longer use $ anymore. 2004-05-19 Sergey Rybin <rybin@act-europe.fr> * sem_ch10.adb (Optional_Subunit): When loading a subunit, do not ignore errors if ASIS_Mode is set. This prevents creating ASIS trees with illegal subunits. 2004-05-19 Ed Schonberg <schonberg@gnat.com> * sem_ch6.adb (Check_Following_Pragma): When compiling a subprogram body with front-end inlining enabled, check whether an inline pragma appears immediately after the body and applies to it. * sem_prag.adb (Cannot_Inline): Emit warning if front-end inlining is enabled and the pragma appears after the body of the subprogram. From-SVN: r82026
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r--gcc/ada/sem_prag.adb27
1 files changed, 18 insertions, 9 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 5daafd5..afbb680 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -2856,15 +2856,17 @@ package body Sem_Prag is
procedure Set_Inline_Flags (Subp : Entity_Id);
-- Sets Is_Inlined and Has_Pragma_Inline flags for Subp
- function Back_End_Cannot_Inline (Subp : Entity_Id) return Boolean;
+ function Cannot_Inline (Subp : Entity_Id) return Boolean;
-- Do not set the inline flag if body is available and contains
-- exception handlers, to prevent undefined symbols at link time.
+ -- Emit warning if front-end inlining is enabled and the pragma
+ -- appears too late.
- ----------------------------
- -- Back_End_Cannot_Inline --
- ----------------------------
+ -------------------
+ -- Cannot_Inline --
+ -------------------
- function Back_End_Cannot_Inline (Subp : Entity_Id) return Boolean is
+ function Cannot_Inline (Subp : Entity_Id) return Boolean is
Decl : constant Node_Id := Unit_Declaration_Node (Subp);
begin
@@ -2876,12 +2878,19 @@ package body Sem_Prag is
elsif Nkind (Decl) = N_Subprogram_Declaration
and then Present (Corresponding_Body (Decl))
then
+ if Front_End_Inlining
+ and then Analyzed (Corresponding_Body (Decl))
+ then
+ Error_Msg_N ("pragma appears too late, ignored?", N);
+ return True;
+
-- If the subprogram is a renaming as body, the body is
-- just a call to the renamed subprogram, and inlining is
-- trivially possible.
- if Nkind (Unit_Declaration_Node (Corresponding_Body (Decl))) =
- N_Subprogram_Renaming_Declaration
+ elsif
+ Nkind (Unit_Declaration_Node (Corresponding_Body (Decl)))
+ = N_Subprogram_Renaming_Declaration
then
return False;
@@ -2897,7 +2906,7 @@ package body Sem_Prag is
return False;
end if;
- end Back_End_Cannot_Inline;
+ end Cannot_Inline;
-----------------
-- Make_Inline --
@@ -2911,7 +2920,7 @@ package body Sem_Prag is
if Etype (Subp) = Any_Type then
return;
- elsif Back_End_Cannot_Inline (Subp) then
+ elsif Cannot_Inline (Subp) then
Applies := True; -- Do not treat as an error.
return;