Check_Ada_2012_Attribute;
Check_Discrete_Type;
- if not Is_Static_Subtype (P_Type) then
- Error_Attr_P ("prefix of % attribute must be a static subtype");
- end if;
+ -- Freeze the subtype now, so that the following test for predicates
+ -- works (we set the predicates stuff up at freeze time)
+
+ Insert_Actions (N, Freeze_Entity (P_Type, P));
+
+ -- Now test for dynamic predicate
if Has_Predicates (P_Type)
and then No (Static_Predicate (P_Type))
("prefix of % attribute may not have dynamic predicate");
end if;
+ -- Check non-static subtype
+
+ if not Is_Static_Subtype (P_Type) then
+ Error_Attr_P ("prefix of % attribute must be a static subtype");
+ end if;
+
+ -- Test case for no values
+
if Expr_Value (Type_Low_Bound (P_Type)) >
Expr_Value (Type_High_Bound (P_Type))
or else (Has_Predicates (P_Type)
-- quantified expression, only a preanalysis of the condition needs
-- to be done.
+ -- This is weird and irregular code for several reasons. First, doing
+ -- an Analyze with no Resolve is very suspicious, how can this be
+ -- right for the overloaded case ??? Second, doing two calls to
+ -- analyze on the same node is peculiar ??? Why can't we use the
+ -- normal Preanalyze calls here ???
+
Expander_Mode_Save_And_Set (False);
Analyze (Condition (N));
Expander_Mode_Restore;
pragma No_Return (Error_Pragma);
-- Outputs error message for current pragma. The message contains a %
-- that will be replaced with the pragma name, and the flag is placed
- -- on the pragma itself. Pragma_Exit is then raised.
+ -- on the pragma itself. Pragma_Exit is then raised. Note: this routine
+ -- calls Fix_Error (see spec of that function for details).
procedure Error_Pragma_Arg (Msg : String; Arg : Node_Id);
pragma No_Return (Error_Pragma_Arg);
-- in which case the flag is placed directly on the expression. The
-- message is placed using Error_Msg_N, so the message may also contain
-- an & insertion character which will reference the given Arg value.
- -- After placing the message, Pragma_Exit is raised.
+ -- After placing the message, Pragma_Exit is raised. Note: this routine
+ -- calls Fix_Error (see spec of that function for details).
procedure Error_Pragma_Arg (Msg1, Msg2 : String; Arg : Node_Id);
pragma No_Return (Error_Pragma_Arg);
-- on the identifier. The message is placed using Error_Msg_N so
-- the message may also contain an & insertion character which will
-- reference the identifier. After placing the message, Pragma_Exit
- -- is raised.
+ -- is raised. Note: this routine calls Fix_Error (see spec of that
+ -- function for details).
procedure Error_Pragma_Ref (Msg : String; Ref : Entity_Id);
pragma No_Return (Error_Pragma_Ref);
-- Outputs error message for current pragma. The message may contain
-- a % that will be replaced with the pragma name. The parameter Ref
-- must be an entity whose name can be referenced by & and sloc by #.
- -- After placing the message, Pragma_Exit is raised.
+ -- After placing the message, Pragma_Exit is raised. Note: this routine
+ -- calls Fix_Error (see spec of that function for details).
function Find_Lib_Unit_Name return Entity_Id;
-- Used for a library unit pragma to find the entity to which the