[Ada] Implement AI12-0269 No_Return for functions
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 18 Mar 2020 22:13:20 +0000 (23:13 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 12 Jun 2020 08:29:08 +0000 (04:29 -0400)
commit90e975175757b4ac9712d90d27ec59cd09f22cc9
treea63f89330826d72e6a5149b4cc5d07561cfafdd7
parenteda72164ade26fe3886515dd55dd9716ff076140
[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.
gcc/ada/einfo.adb
gcc/ada/einfo.ads
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch8.adb
gcc/ada/sem_disp.adb
gcc/ada/sem_prag.adb