summaryrefslogtreecommitdiff
path: root/gcc/ada/inline.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-31 11:15:51 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-31 11:15:51 +0000
commitee46f4066888502bcae0f08c67f19ae8adb85f56 (patch)
tree41ad5c7a0b70cedc5ee2342d3332907ba6375fd6 /gcc/ada/inline.adb
parentf1a9be43ea5e913164bbb216f155853a9c024827 (diff)
downloadgcc-ee46f4066888502bcae0f08c67f19ae8adb85f56.tar.gz
2014-10-31 Eric Botcazou <ebotcazou@adacore.com>
* inline.adb (Has_Excluded_Declaration): With back-end inlining, only return true for nested packages. (Cannot_Inline): Issue errors/warnings whatever the optimization level for back-end inlining and remove assertion. 2014-10-31 Sergey Rybin <rybin@adacore.com frybin> * table.adb (Tree_Read, Tree_Write): Use parentheses to specify the desired order of '*' and '/' operations to avoid overflow. 2014-10-31 Eric Botcazou <ebotcazou@adacore.com> * exp_ch6.adb (Do_Inline): Remove unreachable code. (Do_Inline_Always): Likewise. 2014-10-31 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Check_Stand_Alone_Library): Change error message when library has no Ada interfaces and Library_Standalone is declared. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216961 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r--gcc/ada/inline.adb49
1 files changed, 21 insertions, 28 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 8157bf20a25..dc26d21e136 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -1225,9 +1225,7 @@ package body Inline is
Error_Msg_NE (Msg & "p?", N, Subp);
end if;
- return;
-
- -- New semantics
+ -- New semantics relying on back end inlining
elsif Is_Serious then
@@ -1242,9 +1240,7 @@ package body Inline is
Set_Is_Inlined_Always (Subp, False);
Error_Msg_NE (Msg & "p?", N, Subp);
- -- Do not issue errors/warnings when compiling with optimizations
-
- elsif Optimization_Level = 0 then
+ else
-- Do not emit warning if this is a predefined unit which is not
-- the main unit. This behavior is currently provided for backward
@@ -1281,24 +1277,13 @@ package body Inline is
Error_Msg_NE (Msg (Msg'First .. Msg'Last - 1), N, Subp);
- else pragma Assert (Front_End_Inlining);
+ else
Set_Is_Inlined (Subp, False);
- -- When inlining cannot take place we must issue an error.
- -- For backward compatibility we still report a warning.
-
if Ineffective_Inline_Warnings then
Error_Msg_NE (Msg & "p?", N, Subp);
end if;
end if;
-
- -- Compiling with optimizations enabled it is too early to report
- -- problems since the backend may still perform inlining. In order
- -- to report unhandled inlinings the program must be compiled with
- -- -Winline and the error is reported by the backend.
-
- else
- null;
end if;
end Cannot_Inline;
@@ -3327,11 +3312,25 @@ package body Inline is
D := First (Decls);
while Present (D) loop
- if Nkind (D) = N_Subprogram_Body then
+ -- First declarations universally excluded
+
+ if Nkind (D) = N_Package_Declaration then
Cannot_Inline
- ("cannot inline & (nested subprogram)?",
+ ("cannot inline & (nested package declaration)?",
+ D, Subp);
+ return True;
+
+ elsif Nkind (D) = N_Package_Instantiation then
+ Cannot_Inline
+ ("cannot inline & (nested package instantiation)?",
D, Subp);
return True;
+ end if;
+
+ -- Then declarations excluded only for front end inlining
+
+ if Back_End_Inlining then
+ null;
elsif Nkind (D) = N_Task_Type_Declaration
or else Nkind (D) = N_Single_Task_Declaration
@@ -3349,9 +3348,9 @@ package body Inline is
D, Subp);
return True;
- elsif Nkind (D) = N_Package_Declaration then
+ elsif Nkind (D) = N_Subprogram_Body then
Cannot_Inline
- ("cannot inline & (nested package declaration)?",
+ ("cannot inline & (nested subprogram)?",
D, Subp);
return True;
@@ -3368,12 +3367,6 @@ package body Inline is
("cannot inline & (nested procedure instantiation)?",
D, Subp);
return True;
-
- elsif Nkind (D) = N_Package_Instantiation then
- Cannot_Inline
- ("cannot inline & (nested package instantiation)?",
- D, Subp);
- return True;
end if;
Next (D);