A typical error for new users of Ada is to call functions in a call statement. Improve the error message for these users, to better indicate what the error is in that case.
The following compilation raises the new message. $ gcc -c main.adb 1. procedure Main is 2. function Lol return Integer is (0); 3. begin 4. Lol; | >>> cannot use call to function "Lol" as a statement >>> return value of a function call cannot be ignored 5. end Main; Tested on x86_64-pc-linux-gnu, committed on trunk 2017-09-06 Yannick Moy <m...@adacore.com> * sem_res.adb (Resolve): Update message for function call as statement.
Index: sem_res.adb =================================================================== --- sem_res.adb (revision 251755) +++ sem_res.adb (working copy) @@ -2533,8 +2533,11 @@ 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).