OSDN Git Service

2010-10-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-cidlli.adb
index cf9cdcf..8d1f8e3 100644 (file)
@@ -2,30 +2,27 @@
 --                                                                          --
 --                         GNAT LIBRARY COMPONENTS                          --
 --                                                                          --
---                      A D A . C O N T A I N E R S .                       --
---        I N D E F I N I T E _ D O U B L Y _ L I N K E D _ L I S T S       --
+--               ADA.CONTAINERS.INDEFINITE_DOUBLY_LINKED_LISTS              --
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2004-2006, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2010, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 2,  or (at your option) any later ver- --
+-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT;  see file COPYING.  If not, write --
--- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
--- Boston, MA 02110-1301, USA.                                              --
+-- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
 --                                                                          --
--- As a special exception,  if other files  instantiate  generics from this --
--- unit, or you link  this unit with other files  to produce an executable, --
--- this  unit  does not  by itself cause  the resulting  executable  to  be --
--- covered  by the  GNU  General  Public  License.  This exception does not --
--- however invalidate  any other reasons why  the executable file  might be --
--- covered by the  GNU Public License.                                      --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception,   --
+-- version 3.1, as published by the Free Software Foundation.               --
+--                                                                          --
+-- You should have received a copy of the GNU General Public License and    --
+-- a copy of the GCC Runtime Library Exception along with this program;     --
+-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
+-- <http://www.gnu.org/licenses/>.                                          --
 --                                                                          --
 -- This unit was originally developed by Matthew J Heaney.                  --
 ------------------------------------------------------------------------------
@@ -162,6 +159,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
    procedure Clear (Container : in out List) is
       X : Node_Access;
+      pragma Warnings (Off, X);
 
    begin
       if Container.Length = 0 then
@@ -177,7 +175,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       while Container.Length > 1 loop
@@ -256,7 +254,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       for Index in 1 .. Count loop
@@ -306,7 +304,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       for I in 1 .. Count loop
@@ -344,7 +342,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       for I in 1 .. Count loop
@@ -512,12 +510,12 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
          if Target.Busy > 0 then
             raise Program_Error with
-              "attempt to tamper with elements of Target (list is busy)";
+              "attempt to tamper with cursors of Target (list is busy)";
          end if;
 
          if Source.Busy > 0 then
             raise Program_Error with
-              "attempt to tamper with elements of Source (list is busy)";
+              "attempt to tamper with cursors of Source (list is busy)";
          end if;
 
          LI := First (Target);
@@ -539,6 +537,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
             if RI.Node.Element.all < LI.Node.Element.all then
                declare
                   RJ : Cursor := RI;
+                  pragma Warnings (Off, RJ);
                begin
                   RI.Node := RI.Node.Next;
                   Splice (Target, LI, Source, RJ);
@@ -606,15 +605,9 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
          ----------
 
          procedure Sort (Front, Back : Node_Access) is
-            Pivot : Node_Access;
-
+            Pivot : constant Node_Access :=
+                      (if Front = null then Container.First else Front.Next);
          begin
-            if Front = null then
-               Pivot := Container.First;
-            else
-               Pivot := Front.Next;
-            end if;
-
             if Pivot /= Back then
                Partition (Pivot, Back);
                Sort (Front, Pivot);
@@ -634,7 +627,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
          if Container.Busy > 0 then
             raise Program_Error with
-              "attempt to tamper with elements (list is busy)";
+              "attempt to tamper with cursors (list is busy)";
          end if;
 
          Sort (Front => null, Back => null);
@@ -672,7 +665,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
       if Before.Container /= null then
          if Before.Container /= Container'Unrestricted_Access then
             raise Program_Error with
-              "attempt to tamper with elements (list is busy)";
+              "attempt to tamper with cursors (list is busy)";
          end if;
 
          if Before.Node = null
@@ -696,7 +689,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       declare
@@ -735,6 +728,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
       Count     : Count_Type := 1)
    is
       Position : Cursor;
+      pragma Unreferenced (Position);
    begin
       Insert (Container, Before, New_Item, Position, Count);
    end Insert;
@@ -873,7 +867,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Source.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Source (list is busy)";
+           "attempt to tamper with cursors of Source (list is busy)";
       end if;
 
       Clear (Target);
@@ -1083,7 +1077,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Lock > 0 then
          raise Program_Error with
-           "attempt to tamper with cursors (list is locked)";
+           "attempt to tamper with elements (list is locked)";
       end if;
 
       if Position.Node.Element = null then
@@ -1162,7 +1156,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       Container.First := J;
@@ -1299,12 +1293,12 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Target.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Target (list is busy)";
+           "attempt to tamper with cursors of Target (list is busy)";
       end if;
 
       if Source.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Source (list is busy)";
+           "attempt to tamper with cursors of Source (list is busy)";
       end if;
 
       if Target.Length = 0 then
@@ -1394,7 +1388,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       if Before.Node = null then
@@ -1510,12 +1504,12 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Target.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Target (list is busy)";
+           "attempt to tamper with cursors of Target (list is busy)";
       end if;
 
       if Source.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements of Source (list is busy)";
+           "attempt to tamper with cursors of Source (list is busy)";
       end if;
 
       if Position.Node = Source.First then
@@ -1614,7 +1608,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Lock > 0 then
          raise Program_Error with
-           "attempt to tamper with cursors (list is locked)";
+           "attempt to tamper with elements (list is locked)";
       end if;
 
       pragma Assert (Vet (I), "bad I cursor in Swap");
@@ -1660,7 +1654,7 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
       if Container.Busy > 0 then
          raise Program_Error with
-           "attempt to tamper with elements (list is busy)";
+           "attempt to tamper with cursors (list is busy)";
       end if;
 
       pragma Assert (Vet (I), "bad I cursor in Swap_Links");