* [Ada] Add RM reference to check for functions without a return statement
@ 2022-07-05 8:29 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-05 8:29 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
[-- Attachment #1: Type: text/plain, Size: 197 bytes --]
Add comment to explain why we have an error and not just a warning.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_ch6.adb (Check_Missing_Return): Add reference to an RM rule.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 513 bytes --]
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
--- 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-05 8:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 8:29 [Ada] Add RM reference to check for functions without a return statement Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).