if (No (Expr) or else Entity (Expr) = Standard_True)
and then not Core_Extensions_Allowed
then
+ Error_Msg_GNAT_Extension
+ ("'First_'Controlling_'Parameter", Sloc (Aspect),
+ Is_Core_Extension => True);
goto Continue;
end if;
goto Continue;
end if;
- -- If the aspect is specified for a derived type, the
- -- specified value shall be confirming.
-
if Present (Expr)
- and then Is_Derived_Type (E)
- and then
- Has_First_Controlling_Parameter_Aspect (Etype (E))
and then Entity (Expr) = Standard_False
then
- Error_Msg_Name_1 := Nam;
- Error_Msg_N
- ("specification of inherited aspect% can only "
- & "confirm parent value", Id);
+ -- If the aspect is specified for a derived type,
+ -- the specified value shall be confirming.
+
+ if Is_Derived_Type (E)
+ and then Has_First_Controlling_Parameter_Aspect
+ (Etype (E))
+ then
+ Error_Msg_Name_1 := Nam;
+ Error_Msg_N
+ ("specification of inherited True value for "
+ & "aspect% can only confirm parent value",
+ Id);
+ end if;
+
+ goto Continue;
end if;
-- Given that the aspect has been explicitly given,
----------------------------------------
when Pragma_First_Controlling_Parameter => First_Ctrl_Param : declare
- Arg : Node_Id;
- E : Entity_Id := Empty;
+ Arg : Node_Id;
+ E : Entity_Id := Empty;
+ Expr : Node_Id := Empty;
begin
- if not Core_Extensions_Allowed then
- return;
- end if;
-
GNAT_Pragma;
- Check_Arg_Count (1);
+ Check_At_Least_N_Arguments (1);
+ Check_At_Most_N_Arguments (2);
Arg := Get_Pragma_Arg (Arg1);
+ Check_Arg_Is_Identifier (Arg);
- if Nkind (Arg) = N_Identifier then
- Analyze (Arg);
- E := Entity (Arg);
+ Analyze (Arg);
+ E := Entity (Arg);
+
+ if Present (Arg2) then
+ Check_Arg_Is_OK_Static_Expression (Arg2, Standard_Boolean);
+ Expr := Get_Pragma_Arg (Arg2);
+ Analyze_And_Resolve (Expr, Standard_Boolean);
+ end if;
+
+ if not Core_Extensions_Allowed then
+ if No (Expr)
+ or else
+ (Present (Expr)
+ and then Is_Entity_Name (Expr)
+ and then Entity (Expr) = Standard_True)
+ then
+ Error_Msg_GNAT_Extension
+ ("'First_'Controlling_'Parameter", Sloc (N),
+ Is_Core_Extension => True);
+ end if;
+
+ return;
+
+ elsif Present (Expr)
+ and then Is_Entity_Name (Expr)
+ and then Entity (Expr) = Standard_False
+ then
+ if Is_Derived_Type (E)
+ and then Has_First_Controlling_Parameter_Aspect (Etype (E))
+ then
+ Error_Msg_Name_1 := Name_First_Controlling_Parameter;
+ Error_Msg_N
+ ("specification of inherited True value for aspect% can "
+ & "only confirm parent value", Pragma_Identifier (N));
+ end if;
+
+ return;
end if;
if No (E)