[multiple changes]
[gcc.git] / gcc / ada / a-ciorse.adb
index a330ed8b6c5f082acb980b029421dad92f308d8f..4257f0974e6aa3858f6ff76e14d2720f75aa2778 100644 (file)
@@ -314,8 +314,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
    -- Adjust --
    ------------
 
-   procedure Adjust is
-      new Tree_Operations.Generic_Adjust (Copy_Tree);
+   procedure Adjust is new Tree_Operations.Generic_Adjust (Copy_Tree);
 
    procedure Adjust (Container : in out Set) is
    begin
@@ -329,13 +328,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
    function Ceiling (Container : Set; Item : Element_Type) return Cursor is
       Node : constant Node_Access :=
                Element_Keys.Ceiling (Container.Tree, Item);
-
    begin
-      if Node = null then
-         return No_Element;
-      end if;
-
-      return Cursor'(Container'Unrestricted_Access, Node);
+      return (if Node = null then No_Element
+              else Cursor'(Container'Unrestricted_Access, Node));
    end Ceiling;
 
    -----------
@@ -433,7 +428,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
    procedure Delete_First (Container : in out Set) is
       Tree : Tree_Type renames Container.Tree;
       X    : Node_Access := Tree.First;
-
    begin
       if X /= null then
          Tree_Operations.Delete_Node_Sans_Free (Tree, X);
@@ -448,7 +442,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
    procedure Delete_Last (Container : in out Set) is
       Tree : Tree_Type renames Container.Tree;
       X    : Node_Access := Tree.Last;
-
    begin
       if X /= null then
          Tree_Operations.Delete_Node_Sans_Free (Tree, X);
@@ -466,8 +459,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
    end Difference;
 
    function Difference (Left, Right : Set) return Set is
-      Tree : constant Tree_Type :=
-               Set_Ops.Difference (Left.Tree, Right.Tree);
+      Tree : constant Tree_Type := Set_Ops.Difference (Left.Tree, Right.Tree);
    begin
       return Set'(Controlled with Tree);
    end Difference;
@@ -498,9 +490,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
    function Equivalent_Elements (Left, Right : Element_Type) return Boolean is
    begin
-      if Left < Right
-        or else Right < Left
-      then
+      if Left < Right or else Right < Left then
          return False;
       else
          return True;
@@ -547,7 +537,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
    procedure Exclude (Container : in out Set; Item : Element_Type) is
       X : Node_Access :=
             Element_Keys.Find (Container.Tree, Item);
-
    begin
       if X /= null then
          Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
@@ -577,11 +566,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
    function First (Container : Set) return Cursor is
    begin
-      if Container.Tree.First = null then
-         return No_Element;
-      end if;
-
-      return Cursor'(Container'Unrestricted_Access, Container.Tree.First);
+      return
+        (if Container.Tree.First = null then No_Element
+         else Cursor'(Container'Unrestricted_Access, Container.Tree.First));
    end First;
 
    function First (Object : Iterator) return Cursor is
@@ -611,11 +598,8 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
       Node : constant Node_Access :=
                Element_Keys.Floor (Container.Tree, Item);
    begin
-      if Node = null then
-         return No_Element;
-      else
-         return Cursor'(Container'Unrestricted_Access, Node);
-      end if;
+      return (if Node = null then No_Element
+              else Cursor'(Container'Unrestricted_Access, Node));
    end Floor;
 
    ----------
@@ -685,13 +669,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
       function Ceiling (Container : Set; Key : Key_Type) return Cursor is
          Node : constant Node_Access :=
                   Key_Keys.Ceiling (Container.Tree, Key);
-
       begin
-         if Node = null then
-            return No_Element;
-         end if;
-
-         return Cursor'(Container'Unrestricted_Access, Node);
+         return (if Node = null then No_Element
+                 else Cursor'(Container'Unrestricted_Access, Node));
       end Ceiling;
 
       --------------
@@ -741,9 +721,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
       function Equivalent_Keys (Left, Right : Key_Type) return Boolean is
       begin
-         if Left < Right
-           or else Right < Left
-         then
+         if Left < Right or else Right < Left then
             return False;
          else
             return True;
@@ -756,7 +734,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
       procedure Exclude (Container : in out Set; Key : Key_Type) is
          X : Node_Access := Key_Keys.Find (Container.Tree, Key);
-
       begin
          if X /= null then
             Tree_Operations.Delete_Node_Sans_Free (Container.Tree, X);
@@ -771,13 +748,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
       function Find (Container : Set; Key : Key_Type) return Cursor is
          Node : constant Node_Access :=
                   Key_Keys.Find (Container.Tree, Key);
-
       begin
-         if Node = null then
-            return No_Element;
-         end if;
-
-         return Cursor'(Container'Unrestricted_Access, Node);
+         return (if Node = null then No_Element
+                 else Cursor'(Container'Unrestricted_Access, Node));
       end Find;
 
       -----------
@@ -787,13 +760,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
       function Floor (Container : Set; Key : Key_Type) return Cursor is
          Node : constant Node_Access :=
                   Key_Keys.Floor (Container.Tree, Key);
-
       begin
-         if Node = null then
-            return No_Element;
-         end if;
-
-         return Cursor'(Container'Unrestricted_Access, Node);
+         return (if Node = null then No_Element
+                 else Cursor'(Container'Unrestricted_Access, Node));
       end Floor;
 
       -------------------------
@@ -802,7 +771,8 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
       function Is_Greater_Key_Node
         (Left  : Key_Type;
-         Right : Node_Access) return Boolean is
+         Right : Node_Access) return Boolean
+      is
       begin
          return Key (Right.Element.all) < Left;
       end Is_Greater_Key_Node;
@@ -813,7 +783,8 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
       function Is_Less_Key_Node
         (Left  : Key_Type;
-         Right : Node_Access) return Boolean is
+         Right : Node_Access) return Boolean
+      is
       begin
          return Left < Key (Right.Element.all);
       end Is_Less_Key_Node;
@@ -1179,7 +1150,8 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
    function Is_Greater_Element_Node
      (Left  : Element_Type;
-      Right : Node_Access) return Boolean is
+      Right : Node_Access) return Boolean
+   is
    begin
       --  e > node same as node < e
 
@@ -1192,7 +1164,8 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
    function Is_Less_Element_Node
      (Left  : Element_Type;
-      Right : Node_Access) return Boolean is
+      Right : Node_Access) return Boolean
+   is
    begin
       return Left < Right.Element.all;
    end Is_Less_Element_Node;
@@ -1283,22 +1256,16 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
 
    function Last (Container : Set) return Cursor is
    begin
-      if Container.Tree.Last = null then
-         return No_Element;
-      else
-         return Cursor'(Container'Unrestricted_Access, Container.Tree.Last);
-      end if;
+      return
+        (if Container.Tree.Last = null then No_Element
+         else Cursor'(Container'Unrestricted_Access, Container.Tree.Last));
    end Last;
 
    function Last (Object : Iterator) return Cursor is
    begin
-      if Object.Container.Tree.Last = null then
-         return No_Element;
-      else
-         return Cursor'(
-           Object.Container.all'Unrestricted_Access,
-           Object.Container.Tree.Last);
-      end if;
+      return (if Object.Container.Tree.Last = null then No_Element
+              else Cursor'(Object.Container.all'Unrestricted_Access,
+                           Object.Container.Tree.Last));
    end Last;
 
    ------------------
@@ -1336,8 +1303,7 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
    -- Move --
    ----------
 
-   procedure Move is
-      new Tree_Operations.Generic_Move (Clear);
+   procedure Move is new Tree_Operations.Generic_Move (Clear);
 
    procedure Move (Target : in out Set; Source : in out Set) is
    begin
@@ -1369,13 +1335,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
       declare
          Node : constant Node_Access :=
                   Tree_Operations.Next (Position.Node);
-
       begin
-         if Node = null then
-            return No_Element;
-         end if;
-
-         return Cursor'(Position.Container, Node);
+         return (if Node = null then No_Element
+                 else Cursor'(Position.Container, Node));
       end;
    end Next;
 
@@ -1431,13 +1393,9 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
       declare
          Node : constant Node_Access :=
                   Tree_Operations.Previous (Position.Node);
-
       begin
-         if Node = null then
-            return No_Element;
-         end if;
-
-         return Cursor'(Position.Container, Node);
+         return (if Node = null then No_Element
+                 else Cursor'(Position.Container, Node));
       end;
    end Previous;
 
@@ -1608,15 +1566,15 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
       pragma Inline (New_Node);
 
       procedure Local_Insert_Post is
-         new Element_Keys.Generic_Insert_Post (New_Node);
+        new Element_Keys.Generic_Insert_Post (New_Node);
 
       procedure Local_Insert_Sans_Hint is
-         new Element_Keys.Generic_Conditional_Insert (Local_Insert_Post);
+        new Element_Keys.Generic_Conditional_Insert (Local_Insert_Post);
 
       procedure Local_Insert_With_Hint is
-         new Element_Keys.Generic_Conditional_Insert_With_Hint
-        (Local_Insert_Post,
-         Local_Insert_Sans_Hint);
+        new Element_Keys.Generic_Conditional_Insert_With_Hint
+          (Local_Insert_Post,
+           Local_Insert_Sans_Hint);
 
       --------------
       -- New_Node --
@@ -1629,7 +1587,6 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
          Node.Parent := null;
          Node.Right := null;
          Node.Left := null;
-
          return Node;
       end New_Node;
 
@@ -1829,12 +1786,10 @@ package body Ada.Containers.Indefinite_Ordered_Sets is
    ------------
 
    function To_Set (New_Item : Element_Type) return Set is
-      Tree : Tree_Type;
-
+      Tree     : Tree_Type;
       Node     : Node_Access;
       Inserted : Boolean;
       pragma Unreferenced (Node, Inserted);
-
    begin
       Insert_Sans_Hint (Tree, New_Item, Node, Inserted);
       return Set'(Controlled with Tree);