]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 6 Feb 2014 14:13:53 +0000 (15:13 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 6 Feb 2014 14:13:53 +0000 (15:13 +0100)
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

gcc/ada/ChangeLog
gcc/ada/sem_attr.adb
gcc/ada/sem_prag.adb

index de52b1779e896c91acdd767f8b7d6a3b2fedff6e..01f2489ba5cbfdc05629324125d21f1b17fd0ab7 100644 (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
index 703db44c77f33218c1069491bccb54995ad9abcf..2fb2251a2dba14188311301747ccab45fd736a50 100644 (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);
+         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 --
index 8d453d9ed04f72633471e84322ea648635045f4c..4b304dbbb782ab58a4aa7e08f624393f60f0155e 100644 (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;
 
          ------------------