===================================================================
@@ -5279,8 +5279,7 @@
is
Subp_Alias : constant Entity_Id := Alias (S);
begin
- return S = E
- or else (Present (Subp_Alias) and then Subp_Alias = E);
+ return S = E or else (Present (Subp_Alias) and then Subp_Alias = E);
end Same_Or_Aliased_Subprograms;
-- Start of processing for Resolve_Call
@@ -5630,6 +5629,16 @@
if Comes_From_Source (N) then
Scop := Current_Scope;
+ -- Check violation of SPARK_05 restriction which does not permit
+ -- a subprogram body to contain a call to the subprogram directly.
+
+ if Restriction_Check_Required (SPARK_05)
+ and then Same_Or_Aliased_Subprograms (Nam, Scop)
+ then
+ Check_SPARK_Restriction
+ ("subprogram may not contain direct call to itself", N);
+ end if;
+
-- Issue warning for possible infinite recursion in the absence
-- of the No_Recursion restriction.
===================================================================
@@ -254,7 +254,7 @@
(Msg : String;
N : Node_Id;
Force : Boolean := False);
- -- Node N represents a construct not allowed in formal mode. If this is
+ -- Node N represents a construct not allowed in SPARK_05 mode. If this is
-- a source node, or if the restriction is forced (Force = True), and
-- the SPARK_05 restriction is set, then an error is issued on N. Msg
-- is appended to the restriction failure message.