From: Piotr Trojanek Date: Thu, 2 Jun 2022 13:16:44 +0000 (+0200) Subject: [Ada] Add RM reference to check for functions without a return statement X-Git-Tag: basepoints/gcc-14~5735 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70bb3298c2b4eaec19490ada47dbc3d7307002af;p=thirdparty%2Fgcc.git [Ada] Add RM reference to check for functions without a return statement Add comment to explain why we have an error and not just a warning. gcc/ada/ * sem_ch6.adb (Check_Missing_Return): Add reference to an RM rule. --- diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 5a4ba7a9290..05db793a155 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -3568,6 +3568,10 @@ package body Sem_Ch6 is Id := Body_Id; end if; + -- A function body shall contain at least one return statement + -- that applies to the function body, unless the function contains + -- code_statements; RM 6.5(5). + if Return_Present (Id) then Check_Returns (HSS, 'F', Missing_Ret);