]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix spurious warning for procedure named "Continue"
authorRonan Desplanques <desplanques@adacore.com>
Mon, 11 Aug 2025 13:31:23 +0000 (15:31 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 9 Sep 2025 12:40:01 +0000 (14:40 +0200)
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.

gcc/ada/sem_ch5.adb

index 9e4936bd6293ad675058a1668c63f621e8adb2f2..1db5b75acbe372ea016232070beee91b5c2f83c2 100644 (file)
@@ -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