From: Ronan Desplanques <desplanq...@adacore.com>

The recent addition of a language extension for the "continue"
nonreserved keyword caused spurious warnings about unreferenced
subprograms for procedures named "Continue", because the call
statements that are generated when identifiers are determined not to
refer to the keyword were considered to come from expansion.

This patch fixes this by marking those generated calls as coming from
source instead.

gcc/ada/ChangeLog:

        * sem_ch5.adb (Make_Call): Mark generated nodes as coming from source.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_ch5.adb | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 9e4936bd629..1db5b75acbe 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -1696,10 +1696,15 @@ package body Sem_Ch5 is
       --  interpretation of N.
 
       function Make_Call return N_Procedure_Call_Statement_Id is
+         Id : constant Node_Id := Make_Identifier (Loc, Name_Continue);
+         X : constant N_Procedure_Call_Statement_Id :=
+           Make_Procedure_Call_Statement (Loc, Id);
       begin
-         return
-           Make_Procedure_Call_Statement
-             (Loc, Make_Identifier (Loc, Name_Continue));
+         --  If we settle for the procedure call interpretation, we set
+         --  Comes_From_Source since the user did type out the call explicitly.
+         Set_Comes_From_Source (Id);
+         Set_Comes_From_Source (X);
+         return X;
       end Make_Call;
 
       function Make_Stmt return N_Continue_Statement_Id is
-- 
2.43.0

Reply via email to