+2015-10-16 Bob Duff <duff@adacore.com>
+
+ * debug.adb: Document -gnatdQ switch.
+
+2015-10-16 Ed Schonberg <schonberg@adacore.com>
+
+ * 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 <duff@adacore.com>
* sem_util.ads, sinput.ads, bcheck.adb: Minor comment fixes.
-- 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
-- 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
-- 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.
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
-- 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;
-- 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;
-- 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