-- Common processing for attributes Definite and Has_Discriminants.
-- Checks that prefix is generic indefinite formal type.
+ procedure Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements;
+ -- Common processing for attributes Max_Alignment_For_Allocation and
+ -- Max_Size_In_Storage_Elements.
+
+ procedure Min_Max;
+ -- Common processing for attributes Max and Min
+
procedure Standard_Attribute (Val : Int);
-- Used to process attributes whose prefix is package Standard which
-- yield values of type Universal_Integer. The attribute reference
Set_Etype (N, Standard_Boolean);
end Legal_Formal_Attribute;
+ ---------------------------------------------------------------
+ -- Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements --
+ ---------------------------------------------------------------
+
+ procedure Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements is
+ begin
+ Check_E0;
+ Check_Type;
+ Check_Not_Incomplete_Type;
+ Set_Etype (N, Universal_Integer);
+ end Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements;
+
+ -------------
+ -- Min_Max --
+ -------------
+
+ procedure Min_Max is
+ begin
+ Check_E2;
+ Check_Scalar_Type;
+ Resolve (E1, P_Base_Type);
+ Resolve (E2, P_Base_Type);
+ Set_Etype (N, P_Base_Type);
+
+ -- Check for comparison on unordered enumeration type
+
+ if Bad_Unordered_Enumeration_Reference (N, P_Base_Type) then
+ Error_Msg_Sloc := Sloc (P_Base_Type);
+ Error_Msg_NE
+ ("comparison on unordered enumeration type& declared#?U?",
+ N, P_Base_Type);
+ end if;
+ end Min_Max;
+
------------------------
-- Standard_Attribute --
------------------------
---------
when Attribute_Max =>
- Check_E2;
- Check_Scalar_Type;
- Resolve (E1, P_Base_Type);
- Resolve (E2, P_Base_Type);
- Set_Etype (N, P_Base_Type);
+ Min_Max;
- -- Check for comparison on unordered enumeration type
+ ----------------------------------
+ -- Max_Alignment_For_Allocation --
+ ----------------------------------
- if Bad_Unordered_Enumeration_Reference (N, P_Base_Type) then
- Error_Msg_Sloc := Sloc (P_Base_Type);
- Error_Msg_NE
- ("comparison on unordered enumeration type& declared#?U?",
- N, P_Base_Type);
- end if;
+ when Attribute_Max_Size_In_Storage_Elements =>
+ Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements;
----------------------------------
- -- Max_Alignment_For_Allocation --
-- Max_Size_In_Storage_Elements --
----------------------------------
- when Attribute_Max_Alignment_For_Allocation |
- Attribute_Max_Size_In_Storage_Elements =>
- Check_E0;
- Check_Type;
- Check_Not_Incomplete_Type;
- Set_Etype (N, Universal_Integer);
+ when Attribute_Max_Alignment_For_Allocation =>
+ Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements;
-----------------------
-- Maximum_Alignment --
---------
when Attribute_Min =>
- Check_E2;
- Check_Scalar_Type;
- Resolve (E1, P_Base_Type);
- Resolve (E2, P_Base_Type);
- Set_Etype (N, P_Base_Type);
-
- -- Check for comparison on unordered enumeration type
-
- if Bad_Unordered_Enumeration_Reference (N, P_Base_Type) then
- Error_Msg_Sloc := Sloc (P_Base_Type);
- Error_Msg_NE
- ("comparison on unordered enumeration type& declared#?U?",
- N, P_Base_Type);
- end if;
+ Min_Max;
---------
-- Mod --
Freeze_Before (N, Entity (Name (Call)));
end if;
- -- Ignore pragma Debug in GNATprove mode
+ Rewrite (N, Make_Implicit_If_Statement (N,
+ Condition => Cond,
+ Then_Statements => New_List (
+ Make_Block_Statement (Loc,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => New_List (Relocate_Node (Call)))))));
+ Analyze (N);
+
+ -- Ignore pragma Debug in GNATprove mode. Do this rewriting
+ -- after analysis of the normally rewritten node, to capture all
+ -- references to entities, which avoids issuing wrong warnings
+ -- about unused entities.
if GNATprove_Mode then
Rewrite (N, Make_Null_Statement (Loc));
- else
- Rewrite (N, Make_Implicit_If_Statement (N,
- Condition => Cond,
- Then_Statements => New_List (
- Make_Block_Statement (Loc,
- Handled_Statement_Sequence =>
- Make_Handled_Sequence_Of_Statements (Loc,
- Statements => New_List (Relocate_Node (Call)))))));
end if;
-
- Analyze (N);
end Debug;
------------------