aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/libgnat')
-rw-r--r--gcc/ada/libgnat/a-cihama.adb4
-rw-r--r--gcc/ada/libgnat/a-cihama.ads14
-rw-r--r--gcc/ada/libgnat/a-cohama.adb5
-rw-r--r--gcc/ada/libgnat/a-cohama.ads10
-rw-r--r--gcc/ada/libgnat/a-cohase.adb8
-rw-r--r--gcc/ada/libgnat/a-cohase.ads14
6 files changed, 49 insertions, 6 deletions
diff --git a/gcc/ada/libgnat/a-cihama.adb b/gcc/ada/libgnat/a-cihama.adb
index 7a490d5..50adea1 100644
--- a/gcc/ada/libgnat/a-cihama.adb
+++ b/gcc/ada/libgnat/a-cihama.adb
@@ -522,7 +522,8 @@ is
return No_Element;
end if;
- return Cursor'(Container'Unrestricted_Access, Node, Hash_Type'Last);
+ return Cursor'
+ (Container'Unrestricted_Access, Node, HT_Ops.Index (HT, Node));
end Find;
--------------------
@@ -748,6 +749,7 @@ is
end if;
Position.Container := Container'Unchecked_Access;
+ Position.Position := HT_Ops.Index (HT, Position.Node);
end Insert;
procedure Insert
diff --git a/gcc/ada/libgnat/a-cihama.ads b/gcc/ada/libgnat/a-cihama.ads
index ccf5f4e..f896167 100644
--- a/gcc/ada/libgnat/a-cihama.ads
+++ b/gcc/ada/libgnat/a-cihama.ads
@@ -363,8 +363,22 @@ private
type Cursor is record
Container : Map_Access;
+ -- Access to this cursor's container
+
Node : Node_Access;
+ -- Access to the node pointed to by this cursor
+
Position : Hash_Type := Hash_Type'Last;
+ -- Position of the node in the buckets of the container. If this is
+ -- equal to Hash_Type'Last, then it will not be used. Position is
+ -- not requried by the implementation, but improves the efficiency
+ -- of various operations.
+ --
+ -- However, this value must be maintained so that the predefined
+ -- equality operation acts as required by RM A.18.4-18/2, which
+ -- states: "The predefined "=" operator for type Cursor returns True
+ -- if both cursors are No_Element, or designate the same element
+ -- in the same container."
end record;
procedure Write
diff --git a/gcc/ada/libgnat/a-cohama.adb b/gcc/ada/libgnat/a-cohama.adb
index 9c4e51a..fb46e07 100644
--- a/gcc/ada/libgnat/a-cohama.adb
+++ b/gcc/ada/libgnat/a-cohama.adb
@@ -478,7 +478,8 @@ is
return No_Element;
end if;
- return Cursor'(Container'Unrestricted_Access, Node, Hash_Type'Last);
+ return Cursor'
+ (Container'Unrestricted_Access, Node, HT_Ops.Index (HT, Node));
end Find;
--------------------
@@ -635,6 +636,7 @@ is
end if;
Position.Container := Container'Unrestricted_Access;
+ Position.Position := HT_Ops.Index (HT, Position.Node);
end Insert;
procedure Insert
@@ -677,6 +679,7 @@ is
end if;
Position.Container := Container'Unrestricted_Access;
+ Position.Position := HT_Ops.Index (HT, Position.Node);
end Insert;
procedure Insert
diff --git a/gcc/ada/libgnat/a-cohama.ads b/gcc/ada/libgnat/a-cohama.ads
index 21b6935..c6e377c 100644
--- a/gcc/ada/libgnat/a-cohama.ads
+++ b/gcc/ada/libgnat/a-cohama.ads
@@ -465,7 +465,15 @@ private
Position : Hash_Type := Hash_Type'Last;
-- Position of the node in the buckets of the container. If this is
- -- equal to Hash_Type'Last, then it will not be used.
+ -- equal to Hash_Type'Last, then it will not be used. Position is
+ -- not requried by the implementation, but improves the efficiency
+ -- of various operations.
+ --
+ -- However, this value must be maintained so that the predefined
+ -- equality operation acts as required by RM A.18.4-18/2, which
+ -- states: "The predefined "=" operator for type Cursor returns True
+ -- if both cursors are No_Element, or designate the same element
+ -- in the same container."
end record;
procedure Read
diff --git a/gcc/ada/libgnat/a-cohase.adb b/gcc/ada/libgnat/a-cohase.adb
index 0131f73..aac5b1b 100644
--- a/gcc/ada/libgnat/a-cohase.adb
+++ b/gcc/ada/libgnat/a-cohase.adb
@@ -605,13 +605,13 @@ is
is
HT : Hash_Table_Type renames Container'Unrestricted_Access.HT;
Node : constant Node_Access := Element_Keys.Find (HT, Item);
-
begin
if Node = null then
return No_Element;
end if;
- return Cursor'(Container'Unrestricted_Access, Node, Hash_Type'Last);
+ return Cursor'
+ (Container'Unrestricted_Access, Node, HT_Ops.Index (HT, Node));
end Find;
--------------------
@@ -763,9 +763,11 @@ is
Position : out Cursor;
Inserted : out Boolean)
is
+ HT : Hash_Table_Type renames Container'Unrestricted_Access.HT;
begin
Insert (Container.HT, New_Item, Position.Node, Inserted);
Position.Container := Container'Unchecked_Access;
+ Position.Position := HT_Ops.Index (HT, Position.Node);
end Insert;
procedure Insert
@@ -1998,7 +2000,7 @@ is
return No_Element;
else
return Cursor'
- (Container'Unrestricted_Access, Node, Hash_Type'Last);
+ (Container'Unrestricted_Access, Node, HT_Ops.Index (HT, Node));
end if;
end Find;
diff --git a/gcc/ada/libgnat/a-cohase.ads b/gcc/ada/libgnat/a-cohase.ads
index a0aca52..c1415b5 100644
--- a/gcc/ada/libgnat/a-cohase.ads
+++ b/gcc/ada/libgnat/a-cohase.ads
@@ -537,8 +537,22 @@ private
type Cursor is record
Container : Set_Access;
+ -- Access to this cursor's container
+
Node : Node_Access;
+ -- Access to the node pointed to by this cursor
+
Position : Hash_Type := Hash_Type'Last;
+ -- Position of the node in the buckets of the container. If this is
+ -- equal to Hash_Type'Last, then it will not be used. Position is
+ -- not requried by the implementation, but improves the efficiency
+ -- of various operations.
+ --
+ -- However, this value must be maintained so that the predefined
+ -- equality operation acts as required by RM A.18.7-17/2, which
+ -- states: "The predefined "=" operator for type Cursor returns True
+ -- if both cursors are No_Element, or designate the same element
+ -- in the same container."
end record;
procedure Write