aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-09-06 12:09:23 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-09-06 12:09:23 +0200
commite9238cc1213a6de02d0b17d4581149af71f6a409 (patch)
treedaefa240ed670f39384f5638eb7babab208bf0a4 /gcc
parenta4f4dbdb5aed55635b7977300ed7a860c5cd606a (diff)
downloadgcc-e9238cc1213a6de02d0b17d4581149af71f6a409.zip
gcc-e9238cc1213a6de02d0b17d4581149af71f6a409.tar.gz
gcc-e9238cc1213a6de02d0b17d4581149af71f6a409.tar.bz2
[multiple changes]
2017-09-06 Yannick Moy <moy@adacore.com> * sem_res.adb (Resolve): Update message for function call as statement. 2017-09-06 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Check_Returns): Clean up warnings coming from generated bodies for renamings that are completions, when renamed procedure is No_Return. * sem_ch8.adb (Analyze_Subprogram_Renaming): Implement legality rule in 6.5.1 (7/2): if a renaming is a completion of a subprogram with No_Return, the renamed entity must be No_Return as well. From-SVN: r251768
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog13
-rw-r--r--gcc/ada/sem_ch6.adb6
-rw-r--r--gcc/ada/sem_ch8.adb8
-rw-r--r--gcc/ada/sem_res.adb5
4 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e5e1c7d..785a11a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,16 @@
+2017-09-06 Yannick Moy <moy@adacore.com>
+
+ * sem_res.adb (Resolve): Update message for function call as statement.
+
+2017-09-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Check_Returns): Clean up warnings coming from
+ generated bodies for renamings that are completions, when renamed
+ procedure is No_Return.
+ * sem_ch8.adb (Analyze_Subprogram_Renaming): Implement legality
+ rule in 6.5.1 (7/2): if a renaming is a completion of a subprogram
+ with No_Return, the renamed entity must be No_Return as well.
+
2017-09-06 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch5.adb, freeze.adb, exp_ch4.adb, exp_ch6.adb, lib-xref.adb:
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 837f390..64d87b2 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -6693,7 +6693,11 @@ package body Sem_Ch6 is
Error_Msg_N
("implied return after this statement "
& "would have raised Program_Error", Last_Stm);
- else
+
+ -- In normal compilation mode, do not warn on a generated
+ -- call (e.g. in the body of a renaming as completion).
+
+ elsif Comes_From_Source (Last_Stm) then
Error_Msg_N
("implied return after this statement "
& "will raise Program_Error??", Last_Stm);
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index ca9ac47..82f82d7 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -2946,6 +2946,14 @@ package body Sem_Ch8 is
Check_Fully_Conformant (New_S, Rename_Spec);
Set_Public_Status (New_S);
+ if No_Return (Rename_Spec)
+ and then not No_Return (Entity (Nam))
+ then
+ Error_Msg_N ("renaming completes a No_Return procedure", N);
+ Error_Msg_N
+ ("\renamed procedure must be nonreturning (RM 6.5.1 (7/2))", N);
+ end if;
+
-- The specification does not introduce new formals, but only
-- repeats the formals of the original subprogram declaration.
-- For cross-reference purposes, and for refactoring tools, we
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 79e21e8..6c0d1a7 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -2533,8 +2533,11 @@ package body Sem_Res is
and then Ekind (Entity (Name (N))) = E_Function
then
Error_Msg_NE
- ("cannot use function & in a procedure call",
+ ("cannot use call to function & as a statement",
Name (N), Entity (Name (N)));
+ Error_Msg_N
+ ("\return value of a function call cannot be ignored",
+ Name (N));
-- Otherwise give general message (not clear what cases this
-- covers, but no harm in providing for them).