[Ada] New unit GNAT.Sets

Programming / Compilers / GCC - pmderodat [138bc75d-0d04-0410-961f-82ee72b054a4] - 26 September 2018 09:18 EDT

This patch implements unit GNAT.Sets which currently offers a general purpose membership set. The patch also streamlines GNAT.Dynamic_HTables and GNAT.Lists to use parts of the same API, types, and exceptions as those used by GNAT.Sets.

2018-09-26 Hristian Kirtchev

gcc/ada/

- gcc-interface/Make-lang.in: Add unit GNAT.Sets to the list of front end sources.
- impunit.adb: Add unit GNAT.Sets to the list of predefined units.
- Makefile.rtl: Add unit GNAT.Sets to the list of non-tasking units.
- libgnat/g-sets.adb: New unit.
- libgnat/g-sets.ads: New unit.
- libgnat/g-dynhta.adb (Minimum_Size): Decrease to 8 in order to allow for small sets. Update all occurrences of Table_Locked to Iterated. (Ensure_Unlocked): Query the number of iterators. (Find_Node): Use the supplied equality. (Is_Empty): New routine. (Lock): Update the number of iterators. (Prepend_Or_Replace): Use the supplied equality. (Size): Update the return type. (Unlock): Update the number of iterators.
- libgnat/g-dynhta.ads: Update all occurrences of Table_Locked to Iterated. Rename formal subprogram Equivalent_Keys to "=". (Bucket_Range_Type, Pair_Count_Type): Remove types. (Not_Created, Table_Locked, Iterator_Exhausted): Remove exceptions. (Hash_Table): Update to store the number of iterators rather than locks. (Is_Empty): New routine. (Size): Update the return type.
- libgnat/g-lists.adb: Update all occurrences of List_Locked to Iterated. (Ensure_Unlocked): Query the number of iterators. (Length): Remove. (Lock): Update the number of iterators. (Size): New routine. (Unlock): Update the number of iterators.
- libgnat/g-lists.ads: Update all occurrences of List_Locked to Iterated. (Element_Count_Type): Remove type. (Not_Created, Table_Locked, Iterator_Exhausted): Remove exceptions. (Linked_List): Update type to store the number of iterators rather than locks. (Length): Remove. (Size): New routine.
- libgnat/gnat.ads (Bucket_Range_Type): New type. (Iterated, Iterator_Exhausted, and Not_Created): New exceptions.

gcc/testsuite/

- gnat.dg/sets1.adb: New testcase.
- gnat.dg/dynhash.adb, gnat.dg/linkedlist.adb: Update testcases to new API.

2766f5ddc38 [Ada] New unit GNAT.Sets
gcc/ada/ChangeLog | 48 +++
gcc/ada/Makefile.rtl | 1 +
gcc/ada/gcc-interface/Make-lang.in | 1 +
gcc/ada/impunit.adb | 1 +
gcc/ada/libgnat/g-dynhta.adb | 42 ++-
gcc/ada/libgnat/g-dynhta.ads | 55 +--
gcc/ada/libgnat/g-lists.adb | 37 +-
gcc/ada/libgnat/g-lists.ads | 55 ++-
gcc/ada/libgnat/g-sets.adb | 131 ++++++++
gcc/ada/libgnat/g-sets.ads | 161 +++++++++
gcc/ada/libgnat/gnat.ads | 20 ++
gcc/testsuite/ChangeLog | 6 +
gcc/testsuite/gnat.dg/dynhash.adb | 61 ++--
gcc/testsuite/gnat.dg/linkedlist.adb | 131 ++++----
gcc/testsuite/gnat.dg/sets1.adb | 634 +++++++++++++++++++++++++++++++++++
15 files changed, 1176 insertions(+), 208 deletions(-)

Upstream: gcc.gnu.org


  • Share