Patchwork [Ada] Locally enabled invariants are ignored

login
register
mail settings
Submitter Arnaud Charlet
Date April 25, 2013, 10:13 a.m.
Message ID <20130425101322.GA1174@adacore.com>
Download mbox | patch
Permalink /patch/239453/
State New
Headers show

Comments

Arnaud Charlet - April 25, 2013, 10:13 a.m.
This patch moves routine Find_Pragma from sem_util to einfo. No change in
behavior, no test.

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-04-25  Hristian Kirtchev  <kirtchev@adacore.com>

	* einfo.ads, einfo.adb: Remove with and use clauses for Namet.
	(Find_Pragma): New routine.
	* sem_util.ads, sem_util.adb (Find_Pragma): Moved to einfo.

Patch

Index: einfo.adb
===================================================================
--- einfo.adb	(revision 198282)
+++ einfo.adb	(working copy)
@@ -33,7 +33,6 @@ 
 --  Turn off subprogram ordering, not used for this unit
 
 with Atree;   use Atree;
-with Namet;   use Namet;
 with Nlists;  use Nlists;
 with Output;  use Output;
 with Sinfo;   use Sinfo;
@@ -6102,6 +6101,26 @@ 
       return Etype (Discrete_Subtype_Definition (Parent (Id)));
    end Entry_Index_Type;
 
+   -----------------
+   -- Find_Pragma --
+   -----------------
+
+   function Find_Pragma (Id : Entity_Id; Name : Name_Id) return Node_Id is
+      Item : Node_Id;
+
+   begin
+      Item := First_Rep_Item (Id);
+      while Present (Item) loop
+         if Nkind (Item) = N_Pragma and then Pragma_Name (Item) = Name then
+            return Item;
+         end if;
+
+         Item := Next_Rep_Item (Item);
+      end loop;
+
+      return Empty;
+   end Find_Pragma;
+
    ---------------------
    -- First_Component --
    ---------------------
Index: einfo.ads
===================================================================
--- einfo.ads	(revision 198275)
+++ einfo.ads	(working copy)
@@ -29,6 +29,7 @@ 
 --                                                                          --
 ------------------------------------------------------------------------------
 
+with Namet;  use Namet;
 with Snames; use Snames;
 with Types;  use Types;
 with Uintp;  use Uintp;
@@ -7351,6 +7352,11 @@ 
    --  expression is deferred to the freeze point. For further details see
    --  Sem_Ch13.Analyze_Aspect_Specifications.
 
+   function Find_Pragma (Id : Entity_Id; Name : Name_Id) return Node_Id;
+   --  Given entity Id and pragma name Name, attempt to find the corresponding
+   --  pragma in Id's chain of representation items. The function returns Empty
+   --  if no such pragma has been found.
+
    function Get_Attribute_Definition_Clause
      (E  : Entity_Id;
       Id : Attribute_Id) return Node_Id;
Index: sem_util.adb
===================================================================
--- sem_util.adb	(revision 198282)
+++ sem_util.adb	(working copy)
@@ -4882,26 +4882,6 @@ 
       end if;
    end Find_Parameter_Type;
 
-   -----------------
-   -- Find_Pragma --
-   -----------------
-
-   function Find_Pragma (Id : Entity_Id; Name : Name_Id) return Node_Id is
-      Item : Node_Id;
-
-   begin
-      Item := First_Rep_Item (Id);
-      while Present (Item) loop
-         if Nkind (Item) = N_Pragma and then Pragma_Name (Item) = Name then
-            return Item;
-         end if;
-
-         Item := Next_Rep_Item (Item);
-      end loop;
-
-      return Empty;
-   end Find_Pragma;
-
    -----------------------------
    -- Find_Static_Alternative --
    -----------------------------
Index: sem_util.ads
===================================================================
--- sem_util.ads	(revision 198282)
+++ sem_util.ads	(working copy)
@@ -494,11 +494,6 @@ 
    --  Return the type of formal parameter Param as determined by its
    --  specification.
 
-   function Find_Pragma (Id : Entity_Id; Name : Name_Id) return Node_Id;
-   --  Given entity Id and pragma name Name, attempt to find the corresponding
-   --  pragma in Id's chain of representation items. The function returns Empty
-   --  if no such pragma has been found.
-
    function Find_Static_Alternative (N : Node_Id) return Node_Id;
    --  N is a case statement whose expression is a compile-time value.
    --  Determine the alternative chosen, so that the code of non-selected