public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Check token to be "access", reject it if not
@ 2022-05-17  8:27 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-17  8:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Etienne Servais

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

The parser skips the token without verifying it is indeed "access".  So
any token is accepted.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* par-ch3.adb (P_Access_Type_Definition): Outputs an error if
	token is not "access".

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 611 bytes --]

diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
--- 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;



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-17  8:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17  8:27 [Ada] Check token to be "access", reject it if not 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).