diff options
Diffstat (limited to 'gcc/ada/par-ch12.adb')
-rw-r--r-- | gcc/ada/par-ch12.adb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb index ae6b6cd48d5..0f35d836258 100644 --- a/gcc/ada/par-ch12.adb +++ b/gcc/ada/par-ch12.adb @@ -898,11 +898,13 @@ package body Ch12 is -- SUBPROGRAM_DEFAULT ::= DEFAULT_NAME | <> - -- DEFAULT_NAME ::= NAME + -- DEFAULT_NAME ::= NAME | null -- The caller has checked that the initial tokens are WITH FUNCTION or -- WITH PROCEDURE, and the initial WITH has been scanned out. + -- A null default is an Ada 2005 feature. + -- Error recovery: cannot raise Error_Resync function P_Formal_Subprogram_Declaration return Node_Id is @@ -940,6 +942,22 @@ package body Ch12 is Scan; -- past <> T_Semicolon; + elsif Token = Tok_Null then + if Ada_Version < Ada_05 then + Error_Msg_SP + ("null default subprograms are an Ada 2005 extension"); + Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); + end if; + + if Nkind (Spec_Node) = N_Procedure_Specification then + Set_Null_Present (Spec_Node); + else + Error_Msg_SP ("only procedures can be null"); + end if; + + Scan; -- past NULL + T_Semicolon; + else Set_Default_Name (Def_Node, P_Name); T_Semicolon; |