From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 59638385781D; Tue, 17 May 2022 08:27:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 59638385781D MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-521] [Ada] Check token to be "access", reject it if not X-Act-Checkin: gcc X-Git-Author: Etienne Servais X-Git-Refname: refs/heads/master X-Git-Oldrev: bc17882341b506a7e1052fa5be7ddbb3220cb2b1 X-Git-Newrev: 7cff43618e6f300915ff9061608a974728315146 Message-Id: <20220517082727.59638385781D@sourceware.org> Date: Tue, 17 May 2022 08:27:27 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2022 08:27:27 -0000 https://gcc.gnu.org/g:7cff43618e6f300915ff9061608a974728315146 commit r13-521-g7cff43618e6f300915ff9061608a974728315146 Author: Etienne Servais Date: Wed Mar 16 17:48:22 2022 +0100 [Ada] Check token to be "access", reject it if not The parser skips the token without verifying it is indeed "access". So any token is accepted. gcc/ada/ * par-ch3.adb (P_Access_Type_Definition): Outputs an error if token is not "access". Diff: --- gcc/ada/par-ch3.adb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 08ffd7bf826..d7d12554ffd 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -4205,7 +4205,15 @@ package body Ch3 is -- second null exclusion is present in the access type definition. Not_Null_Present := P_Null_Exclusion; -- Ada 2005 (AI-231) + + if Token /= Tok_Access then + Error_Msg + ("ACCESS expected", + Token_Ptr); + end if; + Scan; -- past ACCESS + Not_Null_Subtype_Loc := Token_Ptr; Not_Null_Subtype := P_Null_Exclusion; -- Might also appear end if;