aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEtienne Servais <servais@adacore.com>2022-03-16 17:48:22 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-17 08:25:40 +0000
commit7cff43618e6f300915ff9061608a974728315146 (patch)
tree9396b8f11c5a3532a44d883f02c131e5cdfcdf6d /gcc
parentbc17882341b506a7e1052fa5be7ddbb3220cb2b1 (diff)
downloadgcc-7cff43618e6f300915ff9061608a974728315146.zip
gcc-7cff43618e6f300915ff9061608a974728315146.tar.gz
gcc-7cff43618e6f300915ff9061608a974728315146.tar.bz2
[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".
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/par-ch3.adb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index 08ffd7b..d7d1255 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;