diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-02-06 15:13:53 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-02-06 15:13:53 +0100 |
commit | 85d6bf87cf2812afff625248bec3b34172cf4ccb (patch) | |
tree | 0b66567da08068f6ca2f78f8c9f5b5edba3b7104 /gcc | |
parent | c3b266d690835cacdc42f2278c5b4eabf9fa99d1 (diff) | |
download | gcc-85d6bf87cf2812afff625248bec3b34172cf4ccb.zip gcc-85d6bf87cf2812afff625248bec3b34172cf4ccb.tar.gz gcc-85d6bf87cf2812afff625248bec3b34172cf4ccb.tar.bz2 |
[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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 83 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 24 |
3 files changed, 75 insertions, 44 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index de52b17..01f2489 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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 diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 703db44..2fb2251 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -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); + 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 -- @@ -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 -- diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 8d453d9..4b304db 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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; ------------------ |