[Ada] Remove dependency on tampering checks and controlled types for formal
authorYannick Moy <moy@adacore.com>
Wed, 16 Feb 2022 12:56:50 +0000 (13:56 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 13 May 2022 08:04:39 +0000 (08:04 +0000)
commit2e2f53d50c6fd17eb87d256d57696acc650a50e1
treeb9feda92254b0b4e2ea3aeb9f9e259c3eefed573
parent6d22fb118f5c292c6c35c9177074485be0159810
[Ada] Remove dependency on tampering checks and controlled types for formal

Formal hashed sets and maps are now using a different type of hash table
that does not require controlled types. This is possible because formal
containers do not rely on tampering checks, as cursors do not hold a
pointer to a single matching container, but are logical indexes that can
be used with multiple containers.

For simplicity of the package organisation, and symmetry with other
versions of containers, add a formal version of hashed types in the
shared Ada.Containers.Hash_Tables unit. This unit should be specialized
to only include the formal version of hash tables for runtimes that
do not support controlled types (so that the dependency on
Ada.Containers.Helpers can be removed).

The new versions of units for generic keys and operations are modified
versions of the units for bounded containers, with all tampering checks
removed (they were no-op in formal containers). A declaration of
constant Checks is added at the start of the body, as these units cannot
use the version in Ada.Containers.Helpers.

gcc/ada/

* Makefile.rtl: Add new files.
* libgnat/a-cfhama.adb: Use formal version of hash tables.
* libgnat/a-cfhama.ads: Same.
* libgnat/a-cfhase.adb: Same.
* libgnat/a-cfhase.ads: Same.
* libgnat/a-chtgfk.adb: New unit for formal containers, modified
version of Generic_Bounded_Keys.
* libgnat/a-chtgfk.ads: Same.
* libgnat/a-chtgfo.adb: New unit for formal containers, modified
version of Generic_Bounded_Operations.
* libgnat/a-chtgfo.ads: Same.
* libgnat/a-cohata.ads (Generic_Formal_Hash_Table_Types): Third
version of the type for hash tables, equivalent to the bounded
version without tampering checks.
gcc/ada/Makefile.rtl
gcc/ada/libgnat/a-cfhama.adb
gcc/ada/libgnat/a-cfhama.ads
gcc/ada/libgnat/a-cfhase.adb
gcc/ada/libgnat/a-cfhase.ads
gcc/ada/libgnat/a-chtgfk.adb [new file with mode: 0644]
gcc/ada/libgnat/a-chtgfk.ads [new file with mode: 0644]
gcc/ada/libgnat/a-chtgfo.adb [new file with mode: 0644]
gcc/ada/libgnat/a-chtgfo.ads [new file with mode: 0644]
gcc/ada/libgnat/a-cohata.ads