Commit 123f0215 by Joffrey Huguet Committed by Pierre-Marie de Rodat

[Ada] Add formal function parameter equality to SPARK containers

This patch adds a formal function parameter "=" (L, R : Element_Type) to
SPARK containers. The equality that is used by default for Element_Type
after this patch is the primitive equality and not the predefined any
more. It also allows to use any function with the appropriate signature
for the equality function.

2019-08-19  Joffrey Huguet  <huguet@adacore.com>

gcc/ada/

	* libgnat/a-cfdlli.ads, libgnat/a-cfhama.ads,
	libgnat/a-cfinve.ads, libgnat/a-cforma.ads,
	libgnat/a-cofove.ads, libgnat/a-cofuma.ads,
	libgnat/a-cofuve.ads: Add formal function parameter "=" (L, R :
	Element_Type) to the generic packages.

From-SVN: r274643
parent b1d7f6fe
2019-08-19 Joffrey Huguet <huguet@adacore.com>
* libgnat/a-cfdlli.ads, libgnat/a-cfhama.ads,
libgnat/a-cfinve.ads, libgnat/a-cforma.ads,
libgnat/a-cofove.ads, libgnat/a-cofuma.ads,
libgnat/a-cofuve.ads: Add formal function parameter "=" (L, R :
Element_Type) to the generic packages.
2019-08-19 Eric Botcazou <ebotcazou@adacore.com> 2019-08-19 Eric Botcazou <ebotcazou@adacore.com>
* opt.ads: Clean up left-overs of earlier implementation in * opt.ads: Clean up left-overs of earlier implementation in
......
...@@ -34,6 +34,7 @@ with Ada.Containers.Functional_Maps; ...@@ -34,6 +34,7 @@ with Ada.Containers.Functional_Maps;
generic generic
type Element_Type is private; type Element_Type is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Formal_Doubly_Linked_Lists with package Ada.Containers.Formal_Doubly_Linked_Lists with
SPARK_Mode SPARK_Mode
......
...@@ -59,6 +59,7 @@ generic ...@@ -59,6 +59,7 @@ generic
with function Equivalent_Keys with function Equivalent_Keys
(Left : Key_Type; (Left : Key_Type;
Right : Key_Type) return Boolean is "="; Right : Key_Type) return Boolean is "=";
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Formal_Hashed_Maps with package Ada.Containers.Formal_Hashed_Maps with
SPARK_Mode SPARK_Mode
......
...@@ -38,6 +38,7 @@ with Ada.Containers.Functional_Vectors; ...@@ -38,6 +38,7 @@ with Ada.Containers.Functional_Vectors;
generic generic
type Index_Type is range <>; type Index_Type is range <>;
type Element_Type (<>) is private; type Element_Type (<>) is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
Max_Size_In_Storage_Elements : Natural; Max_Size_In_Storage_Elements : Natural;
-- Maximum size of Vector elements in bytes. This has the same meaning as -- Maximum size of Vector elements in bytes. This has the same meaning as
-- in Ada.Containers.Bounded_Holders, with the same restrictions. Note that -- in Ada.Containers.Bounded_Holders, with the same restrictions. Note that
......
...@@ -58,6 +58,7 @@ generic ...@@ -58,6 +58,7 @@ generic
type Element_Type is private; type Element_Type is private;
with function "<" (Left, Right : Key_Type) return Boolean is <>; with function "<" (Left, Right : Key_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Formal_Ordered_Maps with package Ada.Containers.Formal_Ordered_Maps with
SPARK_Mode SPARK_Mode
......
...@@ -40,6 +40,8 @@ with Ada.Containers.Functional_Vectors; ...@@ -40,6 +40,8 @@ with Ada.Containers.Functional_Vectors;
generic generic
type Index_Type is range <>; type Index_Type is range <>;
type Element_Type is private; type Element_Type is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Formal_Vectors with package Ada.Containers.Formal_Vectors with
SPARK_Mode SPARK_Mode
is is
......
...@@ -39,6 +39,7 @@ generic ...@@ -39,6 +39,7 @@ generic
with function Equivalent_Keys with function Equivalent_Keys
(Left : Key_Type; (Left : Key_Type;
Right : Key_Type) return Boolean is "="; Right : Key_Type) return Boolean is "=";
with function "=" (Left, Right : Element_Type) return Boolean is <>;
Enable_Handling_Of_Equivalence : Boolean := True; Enable_Handling_Of_Equivalence : Boolean := True;
-- This constant should only be set to False when no particular handling -- This constant should only be set to False when no particular handling
......
...@@ -38,6 +38,7 @@ generic ...@@ -38,6 +38,7 @@ generic
-- should have at least one more element at the low end than Index_Type. -- should have at least one more element at the low end than Index_Type.
type Element_Type (<>) is private; type Element_Type (<>) is private;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Functional_Vectors with SPARK_Mode is package Ada.Containers.Functional_Vectors with SPARK_Mode is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment