[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 20 Oct 2015 12:13:11 +0000 (14:13 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 20 Oct 2015 12:13:11 +0000 (14:13 +0200)
2015-10-20  Tristan Gingold  <gingold@adacore.com>

* sem_util.adb (Is_Protected_Self_Reference): Remove reference to
UET_Address in comment.
* sem_attr.adb (Check_Unit_Name): Adjust comment.
(Analyze_Attribute): Remove handling of UET_Address.
* sem_attr.ads (Attribute_Impl_Def): Remove Attribute_UET_Address.
* snames.ads-tmpl Remove Name_UET_Address, Attribute_UET_Address.
* exp_attr.adb (Expand_N_Attribute_Reference): Remove
Attribute_UET_Address.

2015-10-20  Bob Duff  <duff@adacore.com>

* a-cbdlli.adb, a-cdlili.adb, a-chtgop.adb, a-cidlli.adb,
* a-cobove.adb, a-coinve.adb, a-convec.adb, a-crbtgo.adb ("="): Avoid
modifying the tampering counts unnecessarily.
(Adjust): Zero tampering counts unconditionally.

2015-10-20  Jerome Lambourg  <lambourg@adacore.com>

* init.c: Fix build issue on arm-vx6 when building the RTP
run-time.

2015-10-20  Ed Schonberg  <schonberg@adacore.com>

* sem_ch3.adb (Analyze_Object_Declaration): If the expression
is an aggregate and compilation is in -gnatI mode (ignore rep
clauses) do not delay resolution of aggregate, to prevent freeze
actions out of order in the backend.

2015-10-20  Ed Schonberg  <schonberg@adacore.com>

* sem_prag.ads, sem_prag.adb (Build_Generic_Class_Condition):
New procedure to construct a generic function for a class-wide
precondition, to implement AI12-0113  concerning the new semantics
of class-wide preconditions for overriding uperations.

From-SVN: r229060

18 files changed:
gcc/ada/ChangeLog
gcc/ada/a-cbdlli.adb
gcc/ada/a-cdlili.adb
gcc/ada/a-chtgop.adb
gcc/ada/a-cidlli.adb
gcc/ada/a-cobove.adb
gcc/ada/a-coinve.adb
gcc/ada/a-convec.adb
gcc/ada/a-crbtgo.adb
gcc/ada/exp_attr.adb
gcc/ada/init.c
gcc/ada/sem_attr.adb
gcc/ada/sem_attr.ads
gcc/ada/sem_ch3.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_prag.ads
gcc/ada/sem_util.adb
gcc/ada/snames.ads-tmpl

index e6c099a997b4d495cc63df584f2cc0e714460d36..5584a44eeef01d5139ba6bd1500baa0a49c68a89 100644 (file)
@@ -1,3 +1,40 @@
+2015-10-20  Tristan Gingold  <gingold@adacore.com>
+
+       * sem_util.adb (Is_Protected_Self_Reference): Remove reference to
+       UET_Address in comment.
+       * sem_attr.adb (Check_Unit_Name): Adjust comment.
+       (Analyze_Attribute): Remove handling of UET_Address.
+       * sem_attr.ads (Attribute_Impl_Def): Remove Attribute_UET_Address.
+       * snames.ads-tmpl Remove Name_UET_Address, Attribute_UET_Address.
+       * exp_attr.adb (Expand_N_Attribute_Reference): Remove
+       Attribute_UET_Address.
+
+2015-10-20  Bob Duff  <duff@adacore.com>
+
+       * a-cbdlli.adb, a-cdlili.adb, a-chtgop.adb, a-cidlli.adb,
+       * a-cobove.adb, a-coinve.adb, a-convec.adb, a-crbtgo.adb ("="): Avoid
+       modifying the tampering counts unnecessarily.
+       (Adjust): Zero tampering counts unconditionally.
+
+2015-10-20  Jerome Lambourg  <lambourg@adacore.com>
+
+       * init.c: Fix build issue on arm-vx6 when building the RTP
+       run-time.
+
+2015-10-20  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch3.adb (Analyze_Object_Declaration): If the expression
+       is an aggregate and compilation is in -gnatI mode (ignore rep
+       clauses) do not delay resolution of aggregate, to prevent freeze
+       actions out of order in the backend.
+
+2015-10-20  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_prag.ads, sem_prag.adb (Build_Generic_Class_Condition):
+       New procedure to construct a generic function for a class-wide
+       precondition, to implement AI12-0113  concerning the new semantics
+       of class-wide preconditions for overriding uperations.
+
 2015-10-20  Hristian Kirtchev  <kirtchev@adacore.com>
 
        * sem_util.adb (Find_Actual): The routine is
index 2d8cbdaaeeded18f0cf1df9ce68310670980bbe1..14aad946d491df49452d1c8b082a1558511da8c1 100644 (file)
@@ -84,32 +84,37 @@ package body Ada.Containers.Bounded_Doubly_Linked_Lists is
    ---------
 
    function "=" (Left, Right : List) return Boolean is
-      --  Per AI05-0022, the container implementation is required to detect
-      --  element tampering by a generic actual subprogram.
-
-      Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
-      Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
-
-      LN : Node_Array renames Left.Nodes;
-      RN : Node_Array renames Right.Nodes;
-
-      LI : Count_Type;
-      RI : Count_Type;
    begin
       if Left.Length /= Right.Length then
          return False;
       end if;
 
-      LI := Left.First;
-      RI := Right.First;
-      for J in 1 .. Left.Length loop
-         if LN (LI).Element /= RN (RI).Element then
-            return False;
-         end if;
+      if Left.Length = 0 then
+         return True;
+      end if;
 
-         LI := LN (LI).Next;
-         RI := RN (RI).Next;
-      end loop;
+      declare
+         --  Per AI05-0022, the container implementation is required to detect
+         --  element tampering by a generic actual subprogram.
+
+         Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
+         Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
+
+         LN : Node_Array renames Left.Nodes;
+         RN : Node_Array renames Right.Nodes;
+
+         LI : Count_Type := Left.First;
+         RI : Count_Type := Right.First;
+      begin
+         for J in 1 .. Left.Length loop
+            if LN (LI).Element /= RN (RI).Element then
+               return False;
+            end if;
+
+            LI := LN (LI).Next;
+            RI := RN (RI).Next;
+         end loop;
+      end;
 
       return True;
    end "=";
index 6cd1ae7e400ac841b451d77cd322b6228ac74ba7..036f0aba1692585565f316c595b832fa9ef6cefe 100644 (file)
@@ -73,30 +73,34 @@ package body Ada.Containers.Doubly_Linked_Lists is
    ---------
 
    function "=" (Left, Right : List) return Boolean is
-      --  Per AI05-0022, the container implementation is required to detect
-      --  element tampering by a generic actual subprogram.
-
-      Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
-      Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
-
-      L      : Node_Access;
-      R      : Node_Access;
-
    begin
       if Left.Length /= Right.Length then
          return False;
       end if;
 
-      L := Left.First;
-      R := Right.First;
-      for J in 1 .. Left.Length loop
-         if L.Element /= R.Element then
-            return False;
-         end if;
+      if Left.Length = 0 then
+         return True;
+      end if;
 
-         L := L.Next;
-         R := R.Next;
-      end loop;
+      declare
+         --  Per AI05-0022, the container implementation is required to detect
+         --  element tampering by a generic actual subprogram.
+
+         Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
+         Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
+
+         L : Node_Access := Left.First;
+         R : Node_Access := Right.First;
+      begin
+         for J in 1 .. Left.Length loop
+            if L.Element /= R.Element then
+               return False;
+            end if;
+
+            L := L.Next;
+            R := R.Next;
+         end loop;
+      end;
 
       return True;
    end "=";
@@ -109,10 +113,15 @@ package body Ada.Containers.Doubly_Linked_Lists is
       Src : Node_Access := Container.First;
 
    begin
+      --  If the counts are nonzero, execution is technically erroneous, but
+      --  it seems friendly to allow things like concurrent "=" on shared
+      --  constants.
+
+      Zero_Counts (Container.TC);
+
       if Src = null then
          pragma Assert (Container.Last = null);
          pragma Assert (Container.Length = 0);
-         pragma Assert (Container.TC = (Busy => 0, Lock => 0));
          return;
       end if;
 
index 87a2e1eca83bb827b730360cfe180f5845c6c61b..0d7f88fa3fb5c9c1fb525443af6fb2cd387c0569 100644 (file)
@@ -357,22 +357,7 @@ package body Ada.Containers.Hash_Tables.Generic_Operations is
    function Generic_Equal
      (L, R : Hash_Table_Type) return Boolean
    is
-      --  Per AI05-0022, the container implementation is required to detect
-      --  element tampering by a generic actual subprogram.
-
-      Lock_L : With_Lock (L.TC'Unrestricted_Access);
-      Lock_R : With_Lock (R.TC'Unrestricted_Access);
-
-      L_Index : Hash_Type;
-      L_Node  : Node_Access;
-
-      N : Count_Type;
-
    begin
-      if L'Address = R'Address then
-         return True;
-      end if;
-
       if L.Length /= R.Length then
          return False;
       end if;
@@ -381,44 +366,57 @@ package body Ada.Containers.Hash_Tables.Generic_Operations is
          return True;
       end if;
 
-      --  Find the first node of hash table L
+      declare
+         --  Per AI05-0022, the container implementation is required to detect
+         --  element tampering by a generic actual subprogram.
 
-      L_Index := 0;
-      loop
-         L_Node := L.Buckets (L_Index);
-         exit when L_Node /= null;
-         L_Index := L_Index + 1;
-      end loop;
+         Lock_L : With_Lock (L.TC'Unrestricted_Access);
+         Lock_R : With_Lock (R.TC'Unrestricted_Access);
 
-      --  For each node of hash table L, search for an equivalent node in hash
-      --  table R.
+         L_Index : Hash_Type;
+         L_Node  : Node_Access;
 
-      N := L.Length;
-      loop
-         if not Find (HT => R, Key => L_Node) then
-            return False;
-         end if;
-
-         N := N - 1;
+         N : Count_Type;
+      begin
+         --  Find the first node of hash table L
 
-         L_Node := Next (L_Node);
+         L_Index := 0;
+         loop
+            L_Node := L.Buckets (L_Index);
+            exit when L_Node /= null;
+            L_Index := L_Index + 1;
+         end loop;
 
-         if L_Node = null then
-            --  We have exhausted the nodes in this bucket
+         --  For each node of hash table L, search for an equivalent node in
+         --  hash table R.
 
-            if N = 0 then
-               return True;
+         N := L.Length;
+         loop
+            if not Find (HT => R, Key => L_Node) then
+               return False;
             end if;
 
-            --  Find the next bucket
+            N := N - 1;
 
-            loop
-               L_Index := L_Index + 1;
-               L_Node := L.Buckets (L_Index);
-               exit when L_Node /= null;
-            end loop;
-         end if;
-      end loop;
+            L_Node := Next (L_Node);
+
+            if L_Node = null then
+               --  We have exhausted the nodes in this bucket
+
+               if N = 0 then
+                  return True;
+               end if;
+
+               --  Find the next bucket
+
+               loop
+                  L_Index := L_Index + 1;
+                  L_Node := L.Buckets (L_Index);
+                  exit when L_Node /= null;
+               end loop;
+            end if;
+         end loop;
+      end;
    end Generic_Equal;
 
    -----------------------
index d7995e3e98a01f0145598b856d7769464d8fefe1..7cb4c87f611c444b47036e27e2d3f058dbb2107a 100644 (file)
@@ -76,30 +76,34 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
    ---------
 
    function "=" (Left, Right : List) return Boolean is
-      --  Per AI05-0022, the container implementation is required to detect
-      --  element tampering by a generic actual subprogram.
-
-      Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
-      Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
-
-      L      : Node_Access;
-      R      : Node_Access;
-
    begin
       if Left.Length /= Right.Length then
          return False;
       end if;
 
-      L := Left.First;
-      R := Right.First;
-      for J in 1 .. Left.Length loop
-         if L.Element.all /= R.Element.all then
-            return False;
-         end if;
+      if Left.Length = 0 then
+         return True;
+      end if;
 
-         L := L.Next;
-         R := R.Next;
-      end loop;
+      declare
+         --  Per AI05-0022, the container implementation is required to detect
+         --  element tampering by a generic actual subprogram.
+
+         Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
+         Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
+
+         L : Node_Access := Left.First;
+         R : Node_Access := Right.First;
+      begin
+         for J in 1 .. Left.Length loop
+            if L.Element.all /= R.Element.all then
+               return False;
+            end if;
+
+            L := L.Next;
+            R := R.Next;
+         end loop;
+      end;
 
       return True;
    end "=";
@@ -113,10 +117,15 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
       Dst : Node_Access;
 
    begin
+      --  If the counts are nonzero, execution is technically erroneous, but
+      --  it seems friendly to allow things like concurrent "=" on shared
+      --  constants.
+
+      Zero_Counts (Container.TC);
+
       if Src = null then
          pragma Assert (Container.Last = null);
          pragma Assert (Container.Length = 0);
-         pragma Assert (Container.TC = (Busy => 0, Lock => 0));
          return;
       end if;
 
@@ -127,7 +136,6 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
       Container.First := null;
       Container.Last := null;
       Container.Length := 0;
-      Zero_Counts (Container.TC);
 
       declare
          Element : Element_Access := new Element_Type'(Src.Element.all);
index 4fa7ce8828d4997e1e3c57164587656e87c8952b..fca300d41d6bb0d278c9c38747b9e06700135cb3 100644 (file)
@@ -269,21 +269,28 @@ package body Ada.Containers.Bounded_Vectors is
    ---------
 
    overriding function "=" (Left, Right : Vector) return Boolean is
-      --  Per AI05-0022, the container implementation is required to detect
-      --  element tampering by a generic actual subprogram.
-
-      Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
-      Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
    begin
       if Left.Last /= Right.Last then
          return False;
       end if;
 
-      for J in Count_Type range 1 .. Left.Length loop
-         if Left.Elements (J) /= Right.Elements (J) then
-            return False;
-         end if;
-      end loop;
+      if Left.Length = 0 then
+         return True;
+      end if;
+
+      declare
+         --  Per AI05-0022, the container implementation is required to detect
+         --  element tampering by a generic actual subprogram.
+
+         Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
+         Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
+      begin
+         for J in Count_Type range 1 .. Left.Length loop
+            if Left.Elements (J) /= Right.Elements (J) then
+               return False;
+            end if;
+         end loop;
+      end;
 
       return True;
    end "=";
index 106178a02bf27ce11b1931deb3d97189ac55f9a9..0053de0f4428dc9b689e4e92345776e9344340c8 100644 (file)
@@ -103,29 +103,36 @@ package body Ada.Containers.Indefinite_Vectors is
    ---------
 
    overriding function "=" (Left, Right : Vector) return Boolean is
-      --  Per AI05-0022, the container implementation is required to detect
-      --  element tampering by a generic actual subprogram.
-
-      Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
-      Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
    begin
       if Left.Last /= Right.Last then
          return False;
       end if;
 
-      for J in Index_Type range Index_Type'First .. Left.Last loop
-         if Left.Elements.EA (J) = null then
-            if Right.Elements.EA (J) /= null then
-               return False;
-            end if;
+      if Left.Length = 0 then
+         return True;
+      end if;
 
-         elsif Right.Elements.EA (J) = null then
-            return False;
+      declare
+         --  Per AI05-0022, the container implementation is required to detect
+         --  element tampering by a generic actual subprogram.
 
-         elsif Left.Elements.EA (J).all /= Right.Elements.EA (J).all then
-            return False;
-         end if;
-      end loop;
+         Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
+         Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
+      begin
+         for J in Index_Type range Index_Type'First .. Left.Last loop
+            if Left.Elements.EA (J) = null then
+               if Right.Elements.EA (J) /= null then
+                  return False;
+               end if;
+
+            elsif Right.Elements.EA (J) = null then
+               return False;
+
+            elsif Left.Elements.EA (J).all /= Right.Elements.EA (J).all then
+               return False;
+            end if;
+         end loop;
+      end;
 
       return True;
    end "=";
@@ -136,6 +143,12 @@ package body Ada.Containers.Indefinite_Vectors is
 
    procedure Adjust (Container : in out Vector) is
    begin
+      --  If the counts are nonzero, execution is technically erroneous, but
+      --  it seems friendly to allow things like concurrent "=" on shared
+      --  constants.
+
+      Zero_Counts (Container.TC);
+
       if Container.Last = No_Index then
          Container.Elements := null;
          return;
@@ -149,7 +162,6 @@ package body Ada.Containers.Indefinite_Vectors is
       begin
          Container.Elements := null;
          Container.Last := No_Index;
-         Zero_Counts (Container.TC);
 
          Container.Elements := new Elements_Type (L);
 
index cae5fa0180a4f2833e1a8fde471f86d9d2c4707d..ff11fa952723d9ecc76a452ba3720b0e4fc0e378 100644 (file)
@@ -100,21 +100,28 @@ package body Ada.Containers.Vectors is
    ---------
 
    overriding function "=" (Left, Right : Vector) return Boolean is
-      --  Per AI05-0022, the container implementation is required to detect
-      --  element tampering by a generic actual subprogram.
-
-      Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
-      Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
    begin
       if Left.Last /= Right.Last then
          return False;
       end if;
 
-      for J in Index_Type range Index_Type'First .. Left.Last loop
-         if Left.Elements.EA (J) /= Right.Elements.EA (J) then
-            return False;
-         end if;
-      end loop;
+      if Left.Length = 0 then
+         return True;
+      end if;
+
+      declare
+         --  Per AI05-0022, the container implementation is required to detect
+         --  element tampering by a generic actual subprogram.
+
+         Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
+         Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
+      begin
+         for J in Index_Type range Index_Type'First .. Left.Last loop
+            if Left.Elements.EA (J) /= Right.Elements.EA (J) then
+               return False;
+            end if;
+         end loop;
+      end;
 
       return True;
    end "=";
@@ -125,6 +132,12 @@ package body Ada.Containers.Vectors is
 
    procedure Adjust (Container : in out Vector) is
    begin
+      --  If the counts are nonzero, execution is technically erroneous, but
+      --  it seems friendly to allow things like concurrent "=" on shared
+      --  constants.
+
+      Zero_Counts (Container.TC);
+
       if Container.Last = No_Index then
          Container.Elements := null;
          return;
@@ -137,7 +150,6 @@ package body Ada.Containers.Vectors is
 
       begin
          Container.Elements := null;
-         Zero_Counts (Container.TC);
 
          --  Note: it may seem that the following assignment to Container.Last
          --  is useless, since we assign it to L below. However this code is
index e656295f68365e48e9471fe846c673cc7455be4c..bfc0bcf3a42909bf154e583e4403e8a568e96865 100644 (file)
@@ -514,9 +514,14 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
       Root : constant Node_Access := Tree.Root;
       use type Helpers.Tamper_Counts;
    begin
+      --  If the counts are nonzero, execution is technically erroneous, but
+      --  it seems friendly to allow things like concurrent "=" on shared
+      --  constants.
+
+      Zero_Counts (Tree.TC);
+
       if N = 0 then
          pragma Assert (Root = null);
-         pragma Assert (Tree.TC = (Busy => 0, Lock => 0));
          return;
       end if;
 
@@ -623,16 +628,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
    -------------------
 
    function Generic_Equal (Left, Right : Tree_Type) return Boolean is
-      Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
-      Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
-
-      L_Node : Node_Access;
-      R_Node : Node_Access;
    begin
-      if Left'Address = Right'Address then
-         return True;
-      end if;
-
       if Left.Length /= Right.Length then
          return False;
       end if;
@@ -644,16 +640,22 @@ package body Ada.Containers.Red_Black_Trees.Generic_Operations is
          return True;
       end if;
 
-      L_Node := Left.First;
-      R_Node := Right.First;
-      while L_Node /= null loop
-         if not Is_Equal (L_Node, R_Node) then
-            return False;
-         end if;
+      declare
+         Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
+         Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
 
-         L_Node := Next (L_Node);
-         R_Node := Next (R_Node);
-      end loop;
+         L_Node : Node_Access := Left.First;
+         R_Node : Node_Access := Right.First;
+      begin
+         while L_Node /= null loop
+            if not Is_Equal (L_Node, R_Node) then
+               return False;
+            end if;
+
+            L_Node := Next (L_Node);
+            R_Node := Next (R_Node);
+         end loop;
+      end;
 
       return True;
    end Generic_Equal;
index f6f22f00473c156eb52c0e66e979d369076c3010..781f3a9248796ecbdbfde11b8493da9cc03ad009 100644 (file)
@@ -6152,49 +6152,6 @@ package body Exp_Attr is
             Expand_Fpt_Attribute_R (N);
          end if;
 
-      -----------------
-      -- UET_Address --
-      -----------------
-
-      when Attribute_UET_Address => UET_Address : declare
-         Ent : constant Entity_Id := Make_Temporary (Loc, 'T');
-
-      begin
-         Insert_Action (N,
-           Make_Object_Declaration (Loc,
-             Defining_Identifier => Ent,
-             Aliased_Present     => True,
-             Object_Definition   =>
-               New_Occurrence_Of (RTE (RE_Address), Loc)));
-
-         --  Construct name __gnat_xxx__SDP, where xxx is the unit name
-         --  in normal external form.
-
-         Get_External_Unit_Name_String (Get_Unit_Name (Pref));
-         Name_Buffer (1 + 7 .. Name_Len + 7) := Name_Buffer (1 .. Name_Len);
-         Name_Len := Name_Len + 7;
-         Name_Buffer (1 .. 7) := "__gnat_";
-         Name_Buffer (Name_Len + 1 .. Name_Len + 5) := "__SDP";
-         Name_Len := Name_Len + 5;
-
-         Set_Is_Imported (Ent);
-         Set_Interface_Name (Ent,
-           Make_String_Literal (Loc,
-             Strval => String_From_Name_Buffer));
-
-         --  Set entity as internal to ensure proper Sprint output of its
-         --  implicit importation.
-
-         Set_Is_Internal (Ent);
-
-         Rewrite (N,
-           Make_Attribute_Reference (Loc,
-             Prefix => New_Occurrence_Of (Ent, Loc),
-             Attribute_Name => Name_Address));
-
-         Analyze_And_Resolve (N, Typ);
-      end UET_Address;
-
       ------------
       -- Update --
       ------------
index e905a0b73359b15c986f730cf70a04540a32d6eb..443b33893791aefce5a5c26e65b284ba681e96f9 100644 (file)
@@ -1715,7 +1715,7 @@ __gnat_install_handler (void)
 #include <iv.h>
 #endif
 
-#if defined (ARMEL) && (_WRS_VXWORKS_MAJOR == 6)
+#if defined (ARMEL) && (_WRS_VXWORKS_MAJOR == 6) && !defined(__RTP__)
 #include <vmLib.h>
 #endif
 
@@ -1862,7 +1862,7 @@ __gnat_map_signal (int sig, siginfo_t *si ATTRIBUTE_UNUSED,
      page if there's a match.  Additionally we're are assured this is a
      genuine stack overflow condition and and set the message and exception
      to that effect.  */
-#if defined (ARMEL) && (_WRS_VXWORKS_MAJOR == 6)
+#if defined (ARMEL) && (_WRS_VXWORKS_MAJOR == 6) && !defined(__RTP__)
 
   /* We re-arm the guard page by marking it invalid */
 
@@ -1896,7 +1896,7 @@ __gnat_map_signal (int sig, siginfo_t *si ATTRIBUTE_UNUSED,
          }
        }
     }
-#endif /* defined (ARMEL) && (_WRS_VXWORKS_MAJOR == 6) */
+#endif /* defined (ARMEL) && (_WRS_VXWORKS_MAJOR == 6) && !defined(__RTP__) */
 
   __gnat_clear_exception_count ();
   Raise_From_Signal_Handler (exception, msg);
index fc24b35fa9b8e5d99f1aa054e95d249baf4897dd..4d6bf7c5a18f8a8e1461c2cf67b82a4f8f0dd673 100644 (file)
@@ -388,8 +388,8 @@ package body Sem_Attr is
       --  itself of the form of a library unit name. Note that this is
       --  quite different from Check_Program_Unit, since it only checks
       --  the syntactic form of the name, not the semantic identity. This
-      --  is because it is used with attributes (Elab_Body, Elab_Spec,
-      --  UET_Address and Elaborated) which can refer to non-visible unit.
+      --  is because it is used with attributes (Elab_Body, Elab_Spec and
+      --  Elaborated) which can refer to non-visible unit.
 
       procedure Error_Attr (Msg : String; Error_Node : Node_Id);
       pragma No_Return (Error_Attr);
@@ -2675,7 +2675,6 @@ package body Sem_Attr is
       if Aname /= Name_Elab_Body       and then
          Aname /= Name_Elab_Spec       and then
          Aname /= Name_Elab_Subp_Body  and then
-         Aname /= Name_UET_Address     and then
          Aname /= Name_Enabled         and then
          Aname /= Name_Old
       then
@@ -6026,15 +6025,6 @@ package body Sem_Attr is
 
          Analyze_And_Resolve (N, Standard_String);
 
-      -----------------
-      -- UET_Address --
-      -----------------
-
-      when Attribute_UET_Address =>
-         Check_E0;
-         Check_Unit_Name (P);
-         Set_Etype (N, RTE (RE_Address));
-
       -----------------------
       -- Unbiased_Rounding --
       -----------------------
@@ -9710,7 +9700,6 @@ package body Sem_Attr is
            Attribute_Terminated                   |
            Attribute_To_Address                   |
            Attribute_Type_Key                     |
-           Attribute_UET_Address                  |
            Attribute_Unchecked_Access             |
            Attribute_Universal_Literal_String     |
            Attribute_Unrestricted_Access          |
@@ -11060,16 +11049,6 @@ package body Sem_Attr is
          when Attribute_Result =>
             null;
 
-         -----------------
-         -- UET_Address --
-         -----------------
-
-         --  Prefix must not be resolved in this case, since it is not a
-         --  real entity reference. No action of any kind is require.
-
-         when Attribute_UET_Address =>
-            return;
-
          ----------------------
          -- Unchecked_Access --
          ----------------------
index c1e592844fabf02f127616b0706235e95ab6b51f..d71acb33140063f80a6f6b181aeeee2308560ad5 100644 (file)
@@ -508,16 +508,6 @@ package Sem_Attr is
       --  Aux_DEC into System, then the type Type_Class can be referenced
       --  as an entity within System, as can its enumeration literals.
 
-      -----------------
-      -- UET_Address --
-      -----------------
-
-      Attribute_UET_Address => True,
-      --  Unit'UET_Address, where Unit is a program unit, yields the address
-      --  of the unit exception table for the specified unit. This is only
-      --  used in the internal implementation of exception handling. See the
-      --  implementation of unit Ada.Exceptions for details on its use.
-
       ------------------------------
       -- Universal_Literal_String --
       ------------------------------
index d91f831ec33030158a0dfa8ec1008bcbf4d794cd..22e7cbb9d128d273993296241be989bd7607aa3f 100644 (file)
@@ -3883,11 +3883,18 @@ package body Sem_Ch3 is
          --  the possible presence of an address clause, and defer resolution
          --  and expansion of the aggregate to the freeze point of the entity.
 
+         --  This is not always legal because the aggregate may contain other
+         --  references that need freezing, e.g. references to other entities
+         --  with address clauses. In any case, when compiling with -gnatI the
+         --  presence of the address clause must be ignored.
+
          if Comes_From_Source (N)
            and then Expander_Active
            and then Nkind (E) = N_Aggregate
-           and then (Present (Following_Address_Clause (N))
-                      or else Delayed_Aspect_Present)
+           and then
+             ((Present (Following_Address_Clause (N))
+                            and then not Ignore_Rep_Clauses)
+              or else Delayed_Aspect_Present)
          then
             Set_Etype (E, T);
 
index 2733dc39bd2f1d393e1d2c4c178a5794cba2e017..bb64634c2ad9ecf451a0b725ceb04ffe6dab1074 100644 (file)
@@ -22210,6 +22210,10 @@ package body Sem_Prag is
          end if;
       end if;
 
+      if Class_Present (N) then
+         Build_Generic_Class_Condition (Spec_Id, N);
+      end if;
+
       Preanalyze_Assert_Expression (Expr, Standard_Boolean);
 
       --  For a class-wide condition, a reference to a controlling formal must
@@ -25063,6 +25067,236 @@ package body Sem_Prag is
       return False;
    end Appears_In;
 
+   -----------------------------------
+   -- Build_Generic_Class_Condition --
+   -----------------------------------
+
+   procedure Build_Generic_Class_Condition
+     (Subp : Entity_Id;
+      Prag : Node_Id)
+   is
+      Expr     : constant Node_Id :=
+                   Get_Pragma_Arg
+                     (First (Pragma_Argument_Associations (Prag)));
+      Loc      : constant Source_Ptr := Sloc (Prag);
+      Map      : constant Elist_Id   := New_Elmt_List;
+      New_Expr : constant Node_Id    := New_Copy_Tree (Expr);
+      New_Pred : constant Entity_Id  :=
+                   Make_Defining_Identifier (Loc,
+                     New_External_Name (Chars (Subp), "Pre", -1));
+      Typ      : constant Entity_Id  := Find_Dispatching_Type (Subp);
+
+      function Replace_Formal (N : Node_Id) return Traverse_Result;
+      --  Replace an occurence of a formal parameter of the original expression
+      --  in the precondition, with the formal of the generic function created
+      --  for it.
+
+      --------------------
+      -- Replace_Formal --
+      --------------------
+
+      function Replace_Formal (N : Node_Id) return Traverse_Result is
+         Loc   : constant Source_Ptr := Sloc (N);
+         El    : Elmt_Id;
+         F     : Entity_Id;
+         New_F : Entity_Id;
+
+      begin
+         if Nkind (N) = N_Identifier
+           and then (Nkind (Parent (N)) /= N_Parameter_Association
+             or else N /= Selector_Name (Parent (N)))
+           and then Present (Entity (N))
+           and then Is_Formal (Entity (N))
+         then
+            El := First_Elmt (Map);
+            while Present (El) loop
+               F := Node (El);
+               if Chars (F) = Chars (N) then
+                  New_F := Node (Next_Elmt (El));
+
+                  --  If this is a controlling formal, in the generic it
+                  --  becomes a conversion to the controlling formal of the
+                  --  operation with the classwide precondition. If the formal
+                  --  is an access parameter, a reference to F becomes
+                  --  Root (New_F.all)'access.
+
+                  if Is_Controlling_Formal (F) then
+                     if Is_Access_Type (Etype (F)) then
+                        Rewrite (N,
+                          Make_Attribute_Reference (Loc,
+                            Prefix         =>
+                              Unchecked_Convert_To (
+                                Designated_Type (Etype (F)),
+                                  Make_Explicit_Dereference (Loc,
+                                    Prefix => New_Occurrence_Of (New_F, Loc))),
+                            Attribute_Name => Name_Access));
+
+                     else
+                        Rewrite (N,
+                          Unchecked_Convert_To
+                            (Etype (F), New_Occurrence_Of (New_F, Sloc (N))));
+                     end if;
+
+                  --  Non-controlling formals retain their original type
+
+                  else
+                     Rewrite (N, New_Occurrence_Of (New_F, Sloc (N)));
+                  end if;
+
+                  return OK;
+               end if;
+
+               Next_Elmt (El);
+               Next_Elmt (El);
+            end loop;
+
+         elsif Nkind (N) = N_Parameter_Association then
+            Set_Next_Named_Actual (N, Empty);
+
+         elsif Nkind (N) = N_Function_Call then
+            Set_First_Named_Actual (N, Empty);
+         end if;
+
+         return OK;
+      end Replace_Formal;
+
+      procedure Map_Formals is new Traverse_Proc (Replace_Formal);
+
+      --  Local variables
+
+      Bod      : Node_Id;
+      Decl     : Node_Id;
+      F        : Entity_Id;
+      New_F    : Entity_Id;
+      New_Form : List_Id;
+      New_Typ  : Entity_Id;
+      Par_Typ  : Entity_Id;
+      Spec     : Node_Id;
+
+   --  Start of processing for Build_Generic_Class_Pre
+
+   begin
+      --  Nothing to do if previous error or expansion disabled.
+
+      if not Expander_Active then
+         return;
+      end if;
+
+      if Chars (Pragma_Identifier (Prag)) = Name_Postcondition then
+         return;
+      end if;
+
+      --  Build list of controlling formals and their renamings in the new
+      --  generic operation.
+
+      New_Form := New_List;
+      New_Typ  := Empty;
+
+      F := First_Formal (Subp);
+      while Present (F) loop
+         New_F :=
+           Make_Defining_Identifier (Loc, New_External_Name (Chars (F), "GF"));
+         Set_Ekind (New_F, Ekind (F));
+         Append_Elmt (F, Map);
+         Append_Elmt (New_F, Map);
+
+         if Is_Controlling_Formal (F) then
+            if Is_Access_Type (Etype (F)) then
+               New_Typ :=
+                 Make_Defining_Identifier (Loc,
+                   Chars =>
+                     New_External_Name
+                       (Chars (Designated_Type (Etype (F))), "GT"));
+               Par_Typ :=
+                 Make_Access_Definition (Loc,
+                   Subtype_Mark => New_Occurrence_Of (New_Typ, Loc));
+            else
+               New_Typ :=
+                 Make_Defining_Identifier (Loc,
+                   Chars => New_External_Name (Chars (Etype (F)), "GT"));
+               Par_Typ := New_Occurrence_Of (New_Typ, Loc);
+            end if;
+
+            Append_To (New_Form,
+              Make_Parameter_Specification (Loc,
+                Defining_Identifier => New_F,
+                Parameter_Type      => Par_Typ));
+         else
+            --  If formal has a class-wide type, build same attribute for new
+            --  formal.
+
+            if Is_Class_Wide_Type (Etype (F)) then
+               Append_To (New_Form,
+                 Make_Parameter_Specification (Loc,
+                   Defining_Identifier => New_F,
+                   Parameter_Type      =>
+                     Make_Attribute_Reference (Loc,
+                       Prefix         =>
+                         New_Occurrence_Of (Etype (Etype (F)), Loc),
+                       Attribute_Name => Name_Class)));
+            else
+               Append_To (New_Form,
+                 Make_Parameter_Specification (Loc,
+                   Defining_Identifier => New_F,
+                   Parameter_Type      => New_Occurrence_Of (Etype (F), Loc)));
+            end if;
+         end if;
+
+         Next_Formal (F);
+      end loop;
+
+      --  If no controlling formal found, pre/postcondition is incorrect.
+
+      if No (New_Typ) then
+         return;
+      end if;
+
+      Spec :=
+        Make_Function_Specification (Loc,
+          Defining_Unit_Name       => New_Pred,
+          Parameter_Specifications => New_Form,
+          Result_Definition        =>
+            New_Occurrence_Of (Standard_Boolean, Loc));
+
+      Decl :=
+        Make_Generic_Subprogram_Declaration (Loc,
+          Specification               => Spec,
+          Generic_Formal_Declarations => New_List (
+            Make_Formal_Type_Declaration (Loc,
+              Defining_Identifier    => New_Typ,
+              Formal_Type_Definition =>
+                Make_Formal_Private_Type_Definition (Loc))));
+
+      Preanalyze (New_Expr);
+      Map_Formals (New_Expr);
+
+      Bod :=
+        Make_Subprogram_Body (Loc,
+          Specification              => New_Copy_Tree (Spec),
+          Declarations               => New_List,
+          Handled_Statement_Sequence =>
+            Make_Handled_Sequence_Of_Statements (Loc,
+              Statements => New_List (
+                Make_Simple_Return_Statement (Loc,
+                  Expression => New_Expr))));
+
+      --  Generic function must be analyzed after type is frozen, and will be
+      --  instantiated when subprogram contract for operation or any of its
+      --  overridings is expanded.
+
+      Append_Freeze_Actions (Typ, New_List (Decl, Bod));
+
+      --  We need to convey the existence of the generic to the point at which
+      --  we expand the contract. We replace the expression in the pragma with
+      --  name of the generic function, to be instantiated when expanding the
+      --  contract for the subprogram or some overriding of it. See
+      --  Exp_ch6.Expand_Subprogram_Contract.Build_Pragma_Check_Equivalent.
+      --  (TBD)
+
+      Set_Ekind (New_Pred, E_Generic_Function);
+      Set_Scope (New_Pred, Current_Scope);
+   end Build_Generic_Class_Condition;
+
    -----------------------------
    -- Check_Applicable_Policy --
    -----------------------------
index cdd3657dfdf21095cf2c75deabcde58acfea9046..862c564f0da8adefcc453afc9d7f74d1bd43b092 100644 (file)
@@ -215,6 +215,17 @@ package Sem_Prag is
    procedure Analyze_Test_Case_In_Decl_Part (N : Node_Id);
    --  Perform preanalysis of pragma Test_Case
 
+   procedure Build_Generic_Class_Condition
+     (Subp : Entity_Id;
+      Prag : Node_Id);
+   --  AI12-113 modifies the semantics of classwide pre- and postconditions,
+   --  as well as type invariants, so that the expression used in an inherited
+   --  operation uses the actual type and is statically bound, rather than
+   --  using T'Class and dispatching. This new semantics is implemented by
+   --  building a generic function for the corresponding condition and
+   --  instantiating it for each descendant type. Checking the condition is
+   --  implemented as a call to that instantiation.
+
    procedure Check_Applicable_Policy (N : Node_Id);
    --  N is either an N_Aspect or an N_Pragma node. There are two cases. If
    --  the name of the aspect or pragma is not one of those recognized as
index 8f93bcdb32edc8396a8813cb19d2f0ce5bac0488..e0c857b1177782967d613440f50e087ba786e11d 100644 (file)
@@ -12730,9 +12730,9 @@ package body Sem_Util is
 
    begin
       --  Verify that prefix is analyzed and has the proper form. Note that
-      --  the attributes Elab_Spec, Elab_Body, Elab_Subp_Body and UET_Address,
-      --  which also produce the address of an entity, do not analyze their
-      --  prefix because they denote entities that are not necessarily visible.
+      --  the attributes Elab_Spec, Elab_Body and Elab_Subp_Body which also
+      --  produce the address of an entity, do not analyze their prefix
+      --  because they denote entities that are not necessarily visible.
       --  Neither of them can apply to a protected type.
 
       return Ada_Version >= Ada_2005
index 7f252875cefad6b33f91ff2eca5d07f28bc388b7..881f36589f86e704b8a84a13f8fa66fc24a550cb 100644 (file)
@@ -938,7 +938,6 @@ package Snames is
    Name_To_Address                     : constant Name_Id := N + $; -- GNAT
    Name_Type_Class                     : constant Name_Id := N + $; -- GNAT
    Name_Type_Key                       : constant Name_Id := N + $; -- GNAT
-   Name_UET_Address                    : constant Name_Id := N + $; -- GNAT
    Name_Unbiased_Rounding              : constant Name_Id := N + $;
    Name_Unchecked_Access               : constant Name_Id := N + $;
    Name_Unconstrained_Array            : constant Name_Id := N + $; -- GNAT
@@ -1575,7 +1574,6 @@ package Snames is
       Attribute_To_Address,
       Attribute_Type_Class,
       Attribute_Type_Key,
-      Attribute_UET_Address,
       Attribute_Unbiased_Rounding,
       Attribute_Unchecked_Access,
       Attribute_Unconstrained_Array,