[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
This commit is contained in:
Arnaud Charlet 2014-02-06 15:13:53 +01:00
parent c3b266d690
commit 85d6bf87cf
3 changed files with 76 additions and 45 deletions

View File

@ -1,3 +1,15 @@
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>
* gnat_ugn.texi, vms_data.ads: Add documentation of '-t' option for

View File

@ -396,6 +396,13 @@ package body Sem_Attr is
-- 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
@ -2189,6 +2196,40 @@ package body Sem_Attr is
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 --
------------------------
@ -4107,32 +4148,21 @@ package body Sem_Attr is
---------
when Attribute_Max =>
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;
----------------------------------
-- Max_Alignment_For_Allocation --
----------------------------------
when Attribute_Max_Size_In_Storage_Elements =>
Max_Alignment_For_Allocation_Max_Size_In_Storage_Elements;
----------------------------------
-- 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 --
@ -4177,20 +4207,7 @@ package body Sem_Attr is
---------
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 --

View File

@ -12622,21 +12622,23 @@ package body Sem_Prag is
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;
------------------