Commit 85d6bf87 by Arnaud Charlet

[multiple changes]

2014-02-06  Yannick Moy  <moy@adacore.com>

	* sem_prag.adb (Analyze_Pragma): Analyze pragma
	Debug rewritten node before rewriting it as a null statement in
	GNATprove mode.

2014-02-06  Robert Dewar  <dewar@adacore.com>

	* sem_attr.adb (Min_Max): New procedure.
	(Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements): New
	procedure.

From-SVN: r207558
parent c3b266d6
2014-02-06 Yannick Moy <moy@adacore.com>
* sem_prag.adb (Analyze_Pragma): Analyze pragma
Debug rewritten node before rewriting it as a null statement in
GNATprove mode.
2014-02-06 Robert Dewar <dewar@adacore.com>
* sem_attr.adb (Min_Max): New procedure.
(Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements): New
procedure.
2014-02-06 Sergey Rybin <rybin@adacore.com frybin> 2014-02-06 Sergey Rybin <rybin@adacore.com frybin>
* gnat_ugn.texi, vms_data.ads: Add documentation of '-t' option for * gnat_ugn.texi, vms_data.ads: Add documentation of '-t' option for
......
...@@ -396,6 +396,13 @@ package body Sem_Attr is ...@@ -396,6 +396,13 @@ package body Sem_Attr is
-- Common processing for attributes Definite and Has_Discriminants. -- Common processing for attributes Definite and Has_Discriminants.
-- Checks that prefix is generic indefinite formal type. -- 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); procedure Standard_Attribute (Val : Int);
-- Used to process attributes whose prefix is package Standard which -- Used to process attributes whose prefix is package Standard which
-- yield values of type Universal_Integer. The attribute reference -- yield values of type Universal_Integer. The attribute reference
...@@ -2189,6 +2196,40 @@ package body Sem_Attr is ...@@ -2189,6 +2196,40 @@ package body Sem_Attr is
Set_Etype (N, Standard_Boolean); Set_Etype (N, Standard_Boolean);
end Legal_Formal_Attribute; 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 -- -- Standard_Attribute --
------------------------ ------------------------
...@@ -4107,32 +4148,21 @@ package body Sem_Attr is ...@@ -4107,32 +4148,21 @@ package body Sem_Attr is
--------- ---------
when Attribute_Max => when Attribute_Max =>
Check_E2; Min_Max;
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 ----------------------------------
-- Max_Alignment_For_Allocation --
----------------------------------
if Bad_Unordered_Enumeration_Reference (N, P_Base_Type) then when Attribute_Max_Size_In_Storage_Elements =>
Error_Msg_Sloc := Sloc (P_Base_Type); Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements;
Error_Msg_NE
("comparison on unordered enumeration type& declared#?U?",
N, P_Base_Type);
end if;
---------------------------------- ----------------------------------
-- Max_Alignment_For_Allocation --
-- Max_Size_In_Storage_Elements -- -- Max_Size_In_Storage_Elements --
---------------------------------- ----------------------------------
when Attribute_Max_Alignment_For_Allocation | when Attribute_Max_Alignment_For_Allocation =>
Attribute_Max_Size_In_Storage_Elements => Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements;
Check_E0;
Check_Type;
Check_Not_Incomplete_Type;
Set_Etype (N, Universal_Integer);
----------------------- -----------------------
-- Maximum_Alignment -- -- Maximum_Alignment --
...@@ -4177,20 +4207,7 @@ package body Sem_Attr is ...@@ -4177,20 +4207,7 @@ package body Sem_Attr is
--------- ---------
when Attribute_Min => when Attribute_Min =>
Check_E2; Min_Max;
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;
--------- ---------
-- Mod -- -- Mod --
......
...@@ -12622,21 +12622,23 @@ package body Sem_Prag is ...@@ -12622,21 +12622,23 @@ package body Sem_Prag is
Freeze_Before (N, Entity (Name (Call))); Freeze_Before (N, Entity (Name (Call)));
end if; 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 if GNATprove_Mode then
Rewrite (N, Make_Null_Statement (Loc)); 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; end if;
Analyze (N);
end Debug; end Debug;
------------------ ------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment