From 872dae48e2bb95295eb596e55cabe0eab8792253 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 16 Oct 2015 12:51:32 +0200 Subject: [PATCH] [multiple changes] 2015-10-16 Bob Duff * debug.adb: Document -gnatdQ switch. 2015-10-16 Ed Schonberg * sem_ch12.adb (Analyze_Formal_Subprogram): Implement rule that a formal abstract subprogram cannot have a null default: RM 12.6 (4 1.2). From-SVN: r228869 --- gcc/ada/ChangeLog | 10 ++++++++++ gcc/ada/debug.adb | 7 ++++++- gcc/ada/sem_ch12.adb | 19 +++++++++++++++---- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b36b8de4683..302c4e7657e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2015-10-16 Bob Duff + + * debug.adb: Document -gnatdQ switch. + +2015-10-16 Ed Schonberg + + * sem_ch12.adb (Analyze_Formal_Subprogram): Implement rule that + a formal abstract subprogram cannot have a null default: RM 12.6 + (4 1.2). + 2015-10-16 Bob Duff * sem_util.ads, sinput.ads, bcheck.adb: Minor comment fixes. diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 87e0de74dc6..7f70bfa0217 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -80,7 +80,7 @@ package body Debug is -- dN No file name information in exception messages -- dO Output immediate error messages -- dP Do not check for controlled objects in preelaborable packages - -- dQ + -- dQ Use old secondary stack method -- dR Bypass check for correct version of s-rpc -- dS Never convert numbers to machine numbers in Sem_Eval -- dT Convert to machine numbers only for constant declarations @@ -430,6 +430,11 @@ package body Debug is -- in preelaborable packages, but this restriction is a huge pain, -- especially in the predefined library units. + -- dQ Use old method for determining what goes on the secondary stack. + -- This disables some newer optimizations. The intent is to use this + -- temporarily to measure before/after efficiency. ???Remove this + -- when we are done (see Sem_Util.Requires_Transient_Scope). + -- dR Bypass the check for a proper version of s-rpc being present -- to use the -gnatz? switch. This allows debugging of the use -- of stubs generation without needing to have GLADE (or some diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index ecc3a8e0b0c..481762534bf 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -1075,7 +1075,7 @@ package body Sem_Ch12 is -- package. As usual an other association must be last in the list. procedure Check_Overloaded_Formal_Subprogram (Formal : Entity_Id); - -- Apply RM 12.3 (9): if a formal subprogram is overloaded, the instance + -- Apply RM 12.3(9): if a formal subprogram is overloaded, the instance -- cannot have a named association for it. AI05-0025 extends this rule -- to formals of formal packages by AI05-0025, and it also applies to -- box-initialized formals. @@ -2820,8 +2820,19 @@ package body Sem_Ch12 is if Nkind (N) = N_Formal_Abstract_Subprogram_Declaration then Set_Is_Abstract_Subprogram (Nam); + Set_Is_Dispatching_Operation (Nam); + -- A formal abstract procedure cannot have a null default + -- (RM 12.6(4 1.2)). + + if Nkind (Spec) = N_Procedure_Specification + and then Null_Present (Spec) + then + Error_Msg_N + ("a formal abstract subprogram cannot default to null", Spec); + end if; + declare Ctrl_Type : constant Entity_Id := Find_Dispatching_Type (Nam); begin @@ -10737,7 +10748,7 @@ package body Sem_Ch12 is -- Re-establish the state of information on which checks are suppressed. -- This information was set in Body_Info at the point of instantiation, -- and now we restore it so that the instance is compiled using the - -- check status at the instantiation (RM 11.5 (7.2/2), AI95-00224-01). + -- check status at the instantiation (RM 11.5(7.2/2), AI95-00224-01). Local_Suppress_Stack_Top := Body_Info.Local_Suppress_Stack_Top; Scope_Suppress := Body_Info.Scope_Suppress; @@ -11052,7 +11063,7 @@ package body Sem_Ch12 is -- Re-establish the state of information on which checks are suppressed. -- This information was set in Body_Info at the point of instantiation, -- and now we restore it so that the instance is compiled using the - -- check status at the instantiation (RM 11.5 (7.2/2), AI95-00224-01). + -- check status at the instantiation (RM 11.5(7.2/2), AI95-00224-01). Local_Suppress_Stack_Top := Body_Info.Local_Suppress_Stack_Top; Scope_Suppress := Body_Info.Scope_Suppress; @@ -11970,7 +11981,7 @@ package body Sem_Ch12 is -- If the formal and actual types are abstract, check that there -- are no abstract primitives of the actual type that correspond to -- nonabstract primitives of the formal type (second sentence of - -- RM95-3.9.3(9)). + -- RM95 3.9.3(9)). if Is_Abstract_Type (A_Gen_T) and then Is_Abstract_Type (Act_T) then Check_Abstract_Primitives : declare -- 2.30.2