From: Arnaud Charlet Date: Thu, 2 Jul 2020 10:10:28 +0000 (-0400) Subject: [Ada] Clean up support of square brackets X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e335bd2e6ebc23050d48ad17584323f590733d50;p=gcc.git [Ada] Clean up support of square brackets gcc/ada/ * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Simplify code since we are always under -gnatX if we encounter a Tok_Left_Bracket. * scng.adb (Scan): [] is an aggregate under -gnatX and a wide character otherwise. --- diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index e4ce02fa3af..cc5ed032bbb 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -1395,7 +1395,7 @@ package body Ch4 is begin Lparen_Sloc := Token_Ptr; - if Token = Tok_Left_Bracket and then Ada_Version >= Ada_2020 then + if Token = Tok_Left_Bracket then Scan; -- Special case for null aggregate in Ada 2020 diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 2bac3a8b09b..a2bd176e4fe 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -1378,14 +1378,19 @@ package body Scng is -- Left bracket when '[' => - if Source (Scan_Ptr + 1) = '"' then - goto Scan_Wide_Character; - elsif Ada_Version >= Ada_2020 then + -- [] under -gnatX is an aggregate notation and the special + -- wide character notation becomes unsupported since the two + -- are ambiguous. + + if Extensions_Allowed then Scan_Ptr := Scan_Ptr + 1; Token := Tok_Left_Bracket; return; + elsif Source (Scan_Ptr + 1) = '"' then + goto Scan_Wide_Character; + else Error_Msg_S ("illegal character, replaced by ""("""); Scan_Ptr := Scan_Ptr + 1;