diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb index 5a6a1f4ae5d..a4799c75a78 100644 --- a/gcc/ada/par-ch12.adb +++ b/gcc/ada/par-ch12.adb @@ -949,20 +949,21 @@ package body Ch12 is if Token = Tok_With then - if Ada_Version >= Ada_2020 and not Next_Token_Is (Tok_Private) then - + if Next_Token_Is (Tok_Private) then + Scan; -- past WITH + Set_Private_Present (Def_Node, True); + T_Private; + else -- Formal type has aspect specifications, parsed later. -- Otherwise this is a formal derived type. Note that it may -- also include later aspect specifications, as in: - -- type DT is new T with private with atomic; + -- type DT is new T with private with Atomic; + + Error_Msg_Ada_2020_Feature + ("formal type with aspect specification", Token_Ptr); return Def_Node; - - else - Scan; -- past WITH - Set_Private_Present (Def_Node, True); - T_Private; end if; elsif Token = Tok_Tagged then diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb index 10b4e7b6825..151656ca13d 100644 --- a/gcc/ada/par-ch9.adb +++ b/gcc/ada/par-ch9.adb @@ -752,8 +752,7 @@ package body Ch9 is if Is_Overriding or else Not_Overriding then if Ada_Version < Ada_2005 then - Error_Msg_SP ("overriding indicator is an Ada 2005 extension"); - Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); + Error_Msg_Ada_2005_Extension ("overriding indicator"); elsif Token = Tok_Entry then Decl := P_Entry_Declaration; @@ -962,9 +961,7 @@ package body Ch9 is if Is_Overriding or else Not_Overriding then if Ada_Version < Ada_2005 then - Error_Msg_SP ("overriding indicator is an Ada 2005 extension"); - Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); - + Error_Msg_Ada_2005_Extension ("overriding indicator"); elsif Token /= Tok_Entry then Error_Msg_SC -- CODEFIX ("ENTRY expected!"); diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 0d5cff84d5d..df6a6892d4e 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -25,6 +25,7 @@ with Atree; use Atree; with Csets; use Csets; +with Errout; use Errout; with Hostparm; use Hostparm; with Namet; use Namet; with Opt; use Opt; @@ -1299,19 +1300,15 @@ package body Scng is return; end if; + -- AI12-0125-03 : @ is target_name + when '@' => - if Ada_Version < Ada_2020 then - Error_Msg ("target_name is an Ada 202x feature", Scan_Ptr); - Scan_Ptr := Scan_Ptr + 1; + Error_Msg_Ada_2020_Feature ("target name", Token_Ptr); - else - -- AI12-0125-03 : @ is target_name - - Accumulate_Checksum ('@'); - Scan_Ptr := Scan_Ptr + 1; - Token := Tok_At_Sign; - return; - end if; + Accumulate_Checksum ('@'); + Scan_Ptr := Scan_Ptr + 1; + Token := Tok_At_Sign; + return; -- Asterisk (can be multiplication operator or double asterisk which -- is the exponentiation compound delimiter).