summaryrefslogtreecommitdiff
path: root/gcc/ada/a-cborse.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-cborse.adb')
-rw-r--r--gcc/ada/a-cborse.adb137
1 files changed, 33 insertions, 104 deletions
diff --git a/gcc/ada/a-cborse.adb b/gcc/ada/a-cborse.adb
index 1974c6cccef..674d2abee33 100644
--- a/gcc/ada/a-cborse.adb
+++ b/gcc/ada/a-cborse.adb
@@ -326,7 +326,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function New_Node return Count_Type is
Result : Count_Type;
-
begin
Allocate (Target, Result);
return Result;
@@ -376,13 +375,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Ceiling (Container : Set; Item : Element_Type) return Cursor is
Node : constant Count_Type :=
Element_Keys.Ceiling (Container, Item);
-
begin
- if Node = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Container'Unrestricted_Access, Node);
+ return (if Node = 0 then No_Element
+ else Cursor'(Container'Unrestricted_Access, Node));
end Ceiling;
-----------
@@ -425,10 +420,8 @@ package body Ada.Containers.Bounded_Ordered_Sets is
begin
if Capacity = 0 then
C := Source.Length;
-
elsif Capacity >= Source.Length then
C := Capacity;
-
else
raise Capacity_Error with "Capacity value too small";
end if;
@@ -479,7 +472,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
procedure Delete_First (Container : in out Set) is
X : constant Count_Type := Container.First;
-
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container, X);
@@ -493,7 +485,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
procedure Delete_Last (Container : in out Set) is
X : constant Count_Type := Container.Last;
-
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container, X);
@@ -533,13 +524,7 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Equivalent_Elements (Left, Right : Element_Type) return Boolean is
begin
- if Left < Right
- or else Right < Left
- then
- return False;
- else
- return True;
- end if;
+ return (if Left < Right or else Right < Left then False else True);
end Equivalent_Elements;
---------------------
@@ -559,13 +544,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Is_Equivalent_Node_Node (L, R : Node_Type) return Boolean is
begin
- if L.Element < R.Element then
- return False;
- elsif R.Element < L.Element then
- return False;
- else
- return True;
- end if;
+ return (if L.Element < R.Element then False
+ elsif R.Element < L.Element then False
+ else True);
end Is_Equivalent_Node_Node;
-- Start of processing for Equivalent_Sets
@@ -580,7 +561,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
procedure Exclude (Container : in out Set; Item : Element_Type) is
X : constant Count_Type := Element_Keys.Find (Container, Item);
-
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container, X);
@@ -594,13 +574,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Find (Container : Set; Item : Element_Type) return Cursor is
Node : constant Count_Type := Element_Keys.Find (Container, Item);
-
begin
- if Node = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Container'Unrestricted_Access, Node);
+ return (if Node = 0 then No_Element
+ else Cursor'(Container'Unrestricted_Access, Node));
end Find;
-----------
@@ -609,23 +585,15 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function First (Container : Set) return Cursor is
begin
- if Container.First = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Container'Unrestricted_Access, Container.First);
+ return (if Container.First = 0 then No_Element
+ else Cursor'(Container'Unrestricted_Access, Container.First));
end First;
function First (Object : Iterator) return Cursor is
begin
- if Object.Container.First = 0 then
- return No_Element;
- else
- return
- Cursor'(
- Object.Container.all'Unrestricted_Access,
- Object.Container.First);
- end if;
+ return (if Object.Container.First = 0 then No_Element
+ else Cursor'(Object.Container.all'Unrestricted_Access,
+ Object.Container.First));
end First;
-------------------
@@ -647,13 +615,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Floor (Container : Set; Item : Element_Type) return Cursor is
Node : constant Count_Type := Element_Keys.Floor (Container, Item);
-
begin
- if Node = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Container'Unrestricted_Access, Node);
+ return (if Node = 0 then No_Element
+ else Cursor'(Container'Unrestricted_Access, Node));
end Floor;
------------------
@@ -694,13 +658,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Ceiling (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type :=
Key_Keys.Ceiling (Container, Key);
-
begin
- if Node = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Container'Unrestricted_Access, Node);
+ return (if Node = 0 then No_Element
+ else Cursor'(Container'Unrestricted_Access, Node));
end Ceiling;
--------------
@@ -749,13 +709,7 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Equivalent_Keys (Left, Right : Key_Type) return Boolean is
begin
- if Left < Right
- or else Right < Left
- then
- return False;
- else
- return True;
- end if;
+ return (if Left < Right or else Right < Left then False else True);
end Equivalent_Keys;
-------------
@@ -764,7 +718,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
procedure Exclude (Container : in out Set; Key : Key_Type) is
X : constant Count_Type := Key_Keys.Find (Container, Key);
-
begin
if X /= 0 then
Tree_Operations.Delete_Node_Sans_Free (Container, X);
@@ -778,13 +731,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Find (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type := Key_Keys.Find (Container, Key);
-
begin
- if Node = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Container'Unrestricted_Access, Node);
+ return (if Node = 0 then No_Element
+ else Cursor'(Container'Unrestricted_Access, Node));
end Find;
-----------
@@ -793,13 +742,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Floor (Container : Set; Key : Key_Type) return Cursor is
Node : constant Count_Type := Key_Keys.Floor (Container, Key);
-
begin
- if Node = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Container'Unrestricted_Access, Node);
+ return (if Node = 0 then No_Element
+ else Cursor'(Container'Unrestricted_Access, Node));
end Floor;
-------------------------
@@ -1069,7 +1014,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function New_Node return Count_Type is
Result : Count_Type;
-
begin
Allocate (Container, Result);
return Result;
@@ -1133,7 +1077,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function New_Node return Count_Type is
Result : Count_Type;
-
begin
Allocate (Dst_Set, Result);
return Result;
@@ -1287,22 +1230,15 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Last (Container : Set) return Cursor is
begin
- if Container.Last = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Container'Unrestricted_Access, Container.Last);
+ return (if Container.Last = 0 then No_Element
+ else Cursor'(Container'Unrestricted_Access, Container.Last));
end Last;
function Last (Object : Iterator) return Cursor is
begin
- if Object.Container.Last = 0 then
- return No_Element;
- else
- return Cursor'(
- Object.Container.all'Unrestricted_Access,
- Object.Container.Last);
- end if;
+ return (if Object.Container.Last = 0 then No_Element
+ else Cursor'(Object.Container.all'Unrestricted_Access,
+ Object.Container.Last));
end Last;
------------------
@@ -1388,7 +1324,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function Next (Object : Iterator; Position : Cursor) return Cursor is
pragma Unreferenced (Object);
-
begin
return Next (Position);
end Next;
@@ -1427,13 +1362,9 @@ package body Ada.Containers.Bounded_Ordered_Sets is
Tree_Operations.Previous
(Position.Container.all,
Position.Node);
-
begin
- if Node = 0 then
- return No_Element;
- end if;
-
- return Cursor'(Position.Container, Node);
+ return (if Node = 0 then No_Element
+ else Cursor'(Position.Container, Node));
end;
end Previous;
@@ -1466,7 +1397,6 @@ package body Ada.Containers.Bounded_Ordered_Sets is
declare
S : Set renames Position.Container.all;
-
B : Natural renames S.Busy;
L : Natural renames S.Lock;
@@ -1608,11 +1538,10 @@ package body Ada.Containers.Bounded_Ordered_Sets is
function New_Node return Count_Type is
begin
Node.Element := Item;
- Node.Color := Red_Black_Trees.Red;
- Node.Parent := 0;
- Node.Right := 0;
- Node.Left := 0;
-
+ Node.Color := Red_Black_Trees.Red;
+ Node.Parent := 0;
+ Node.Right := 0;
+ Node.Left := 0;
return Index;
end New_Node;