aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_disp.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-03-18 23:13:20 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-12 04:29:08 -0400
commit90e975175757b4ac9712d90d27ec59cd09f22cc9 (patch)
treea63f89330826d72e6a5149b4cc5d07561cfafdd7 /gcc/ada/sem_disp.adb
parenteda72164ade26fe3886515dd55dd9716ff076140 (diff)
downloadgcc-90e975175757b4ac9712d90d27ec59cd09f22cc9.zip
gcc-90e975175757b4ac9712d90d27ec59cd09f22cc9.tar.gz
gcc-90e975175757b4ac9712d90d27ec59cd09f22cc9.tar.bz2
[Ada] Implement AI12-0269 No_Return for functions
2020-06-12 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * einfo.ads (No_Return): Document it for all subprograms. * einfo.adb (Set_No_Return): Adjust assertion accordingly. * sem_ch3.adb (Check_Abstract_Overriding): Implement the check prescribed by RM 6.5.1(6/2) here instead of... (Derive_Subprogram): Adjust comment accordingly. * sem_disp.adb (Override_Dispatching_Operation): ...here. Remove superfluous return statement. * sem_ch6.adb (Check_No_Return_Expression): New procedure. (Analyze_Function_Return): Call it to implement the check prescribed by AI12-0269 for simple return statements of No_Return functions, and also checks extended statements. (Analyze_Return_Statement): Only give an error on a return statement in No_Return procedures. Use idiomatic form. * sem_ch8.adb (Analyze_Subprogram_Renaming): Adjust error message for No_Return renaming subprogram. * sem_prag.adb (Analyze_Pragma) <Pragma_No_Return>: Accept it on functions and generic functions in Ada 2020.
Diffstat (limited to 'gcc/ada/sem_disp.adb')
-rw-r--r--gcc/ada/sem_disp.adb9
1 files changed, 0 insertions, 9 deletions
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index a2fbcfc..3b40f4c 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -2548,14 +2548,6 @@ package body Sem_Disp is
Prim : Node_Id;
begin
- -- Diagnose failure to match No_Return in parent (Ada-2005, AI-414, but
- -- we do it unconditionally in Ada 95 now, since this is our pragma).
-
- if No_Return (Prev_Op) and then not No_Return (New_Op) then
- Error_Msg_N ("procedure & must have No_Return pragma", New_Op);
- Error_Msg_N ("\since overridden procedure has No_Return", New_Op);
- end if;
-
-- If there is no previous operation to override, the type declaration
-- was malformed, and an error must have been emitted already.
@@ -2666,7 +2658,6 @@ package body Sem_Disp is
Set_Alias (Prev_Op, New_Op);
Set_DTC_Entity (Prev_Op, Empty);
Set_Has_Controlling_Result (New_Op, Has_Controlling_Result (Prev_Op));
- return;
end if;
end Override_Dispatching_Operation;