6 Commits
Author SHA1 Message Date
Bruno Haible 2a4f56f67f tests: Depend on 'bool' for use of 'false' or 'true'.
* modules/array-list-tests (Depends-on): Add bool.
* modules/array-map-tests (Depends-on): Likewise.
* modules/array-omap-tests (Depends-on): Likewise.
* modules/array-oset-tests (Depends-on): Likewise.
* modules/asyncsafe-spin-tests (Depends-on): Likewise.
* modules/avltree-list-tests (Depends-on): Likewise.
* modules/avltreehash-list-tests (Depends-on): Likewise.
* modules/bitset-tests (Depends-on): Likewise.
* modules/canonicalize-lgpl-tests (Depends-on): Likewise.
* modules/canonicalize-tests (Depends-on): Likewise.
* modules/carray-list-tests (Depends-on): Likewise.
* modules/cloexec-tests (Depends-on): Likewise.
* modules/cnd-tests (Depends-on): Likewise.
* modules/cond-tests (Depends-on): Likewise.
* modules/dirname-tests (Depends-on): Likewise.
* modules/explicit_bzero-tests (Depends-on): Likewise.
* modules/fchownat-tests (Depends-on): Likewise.
* modules/fdutimensat-tests (Depends-on): Likewise.
* modules/fstatat-tests (Depends-on): Likewise.
* modules/futimens-tests (Depends-on): Likewise.
* modules/hamt-tests (Depends-on): Likewise.
* modules/hard-locale-tests (Depends-on): Likewise.
* modules/kwset-tests (Depends-on): Likewise.
* modules/linkat-tests (Depends-on): Likewise.
* modules/linked-list-tests (Depends-on): Likewise.
* modules/linked-list-unportable-tests (Depends-on): Likewise.
* modules/linkedhash-list-tests (Depends-on): Likewise.
* modules/mbs_endswith-tests (Depends-on): Likewise.
* modules/mbs_startswith-tests (Depends-on): Likewise.
* modules/mbscasecmp-tests (Depends-on): Likewise.
* modules/mbsncasecmp-tests (Depends-on): Likewise.
* modules/mbspcasecmp-tests (Depends-on): Likewise.
* modules/mcel-bench-tests (Depends-on): Likewise.
* modules/memset_explicit-tests (Depends-on): Likewise.
* modules/mkdirat-tests (Depends-on): Likewise.
* modules/mkfifoat-tests (Depends-on): Likewise.
* modules/mountlist-tests (Depends-on): Likewise.
* modules/nonblocking-tests (Depends-on): Likewise.
* modules/obstack-zprintf-extra-tests (Depends-on): Likewise.
* modules/openat-tests (Depends-on): Likewise.
* modules/openat2-tests (Depends-on): Likewise.
* modules/pipe-filter-gi-tests (Depends-on): Likewise.
* modules/pipe-filter-ii-tests (Depends-on): Likewise.
* modules/posix_spawn_file_actions_addchdir-tests (Depends-on):
Likewise.
* modules/printf-posix-tests (Depends-on): Likewise.
* modules/pthread-cond-tests (Depends-on): Likewise.
* modules/pthread_sigmask-tests (Depends-on): Likewise.
* modules/quotearg-tests (Depends-on): Likewise.
* modules/rbtree-list-tests (Depends-on): Likewise.
* modules/rbtreehash-list-tests (Depends-on): Likewise.
* modules/readlinkat-tests (Depends-on): Likewise.
* modules/regex-quote-tests (Depends-on): Likewise.
* modules/renameat-tests (Depends-on): Likewise.
* modules/renameatu-tests (Depends-on): Likewise.
* modules/sigdelay-tests (Depends-on): Likewise.
* modules/sigprocmask-tests (Depends-on): Likewise.
* modules/stat-time-tests (Depends-on): Likewise.
* modules/stdc_rotate_left-tests (Depends-on): Likewise.
* modules/stdc_rotate_right-tests (Depends-on): Likewise.
* modules/striconveha-tests (Depends-on): Likewise.
* modules/supersede-tests (Depends-on): Likewise.
* modules/symlinkat-tests (Depends-on): Likewise.
* modules/unicase/u8-is-cased-tests (Depends-on): Likewise.
* modules/unicase/u8-is-casefolded-tests (Depends-on): Likewise.
* modules/unicase/u8-is-lowercase-tests (Depends-on): Likewise.
* modules/unicase/u8-is-titlecase-tests (Depends-on): Likewise.
* modules/unicase/u8-is-uppercase-tests (Depends-on): Likewise.
* modules/unicase/u16-is-cased-tests (Depends-on): Likewise.
* modules/unicase/u16-is-casefolded-tests (Depends-on): Likewise.
* modules/unicase/u16-is-lowercase-tests (Depends-on): Likewise.
* modules/unicase/u16-is-titlecase-tests (Depends-on): Likewise.
* modules/unicase/u16-is-uppercase-tests (Depends-on): Likewise.
* modules/unicase/u32-is-cased-tests (Depends-on): Likewise.
* modules/unicase/u32-is-casefolded-tests (Depends-on): Likewise.
* modules/unicase/u32-is-lowercase-tests (Depends-on): Likewise.
* modules/unicase/u32-is-titlecase-tests (Depends-on): Likewise.
* modules/unicase/u32-is-uppercase-tests (Depends-on): Likewise.
* modules/unictype/scripts-tests (Depends-on): Likewise.
* modules/unlinkat-tests (Depends-on): Likewise.
* modules/userspec-tests (Depends-on): Likewise.
* modules/utime-tests (Depends-on): Likewise.
* modules/utimens-tests (Depends-on): Likewise.
* modules/utimensat-tests (Depends-on): Likewise.
2026-08-17 16:12:22 +02:00
Paul Eggert 019cd1b4cc bitrotate: prefer C2y to bitrotate or by-hand
Deprecate the bitrotate module; it is superseded by C2y’s
stdc_rotate_left and stdc_rotate_right.  In several places, prefer
the C2y functions to doing things by hand.
* lib/arctwo.c (arctwo_encrypt, arctwo_decyrpt):
* lib/hash.c (raw_hasher):
* lib/hashcode-mem.c (hash_pjw_bare):
* lib/hashcode-string1.c (hash_string):
* lib/hashcode-string2.c (hash_pjw):
* lib/hashkey-string.c (hashkey_string_hash):
* lib/mem-hash-map.c (compute_hashval):
* lib/struniq.h (hash):
* tests/test-array_map.c (string_hash):
* tests/test-avltreehash_list.c (string_hash):
* tests/test-hash_map.c (string_hash):
* tests/test-linkedhash_list.c (string_hash):
* tests/test-linkedhash_map.c (string_hash):
* tests/test-rbtreehash_list.c (string_hash):
Use stdbit.h functions, instead of bitrotate.h functions or doing
things by hand.  Include stdbit.h to get them.  Don’t include
bitrotate.h, if it was being included.
* lib/getlocalename_l-unsafe.c, lib/getlocalename_l.c:
* lib/localename.c:
Include stdbit.h, since struniq.h now needs this.
* lib/hashcode-mem.c, lib/hashcode-string2.c, lib/hashkey-string.c:
* lib/struniq.h, tests/test-array_map.c, tests/test-avltreehash_list.c:
* tests/test-hash_map.c, tests/test-linkedhash_list.c:
* tests/test-linkedhash_map.c, tests/test-rbtreehash_list.c:
(SIZE_BITS): Remove; no longer needed.
* modules/array-map-tests, modules/avltreehash-list-tests:
* modules/crypto/arctwo, modules/getlocalename_l-simple:
* modules/getlocalename_l-unsafe, modules/hash:
* modules/hash-map-tests, modules/hashcode-mem:
* modules/hashcode-string1, modules/hashcode-string2:
* modules/hashkey-string, modules/linkedhash-list-tests:
* modules/linkedhash-map-tests, modules/localename:
* modules/mem-hash-map, modules/rbtree-list-tests:
Depend on stdc_rotate_left.
Don’t depend on bitrotate, if we were depending on it.
* modules/bitrotate: Deprecate.
* modules/crypto/arctwo: Depend on stdc_rotate_right.
2026-06-26 14:34:58 -07:00
Bruno Haible f1d55e9f84 Use countof, part 2.
Done through  sed -e 's/SIZEOF \([(][^()]*[)]\)/countof \1/g'

* lib/boot-time.c: Include <stdcountof.h>.
* lib/readutmp.c: Include <stdcountof.h>.
* lib/boot-time-aux.h (get_linux_boot_time_fallback,
get_openbsd_boot_time, get_windows_boot_time): Use countof.
* lib/duplocale.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(duplocale): Use countof instead.
* lib/fatal-signal.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(num_fatal_signals, actions_allocated): Use countof instead.
* lib/iconv_open.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(rpl_iconv_open): Use countof instead.
* lib/term-style-control.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(num_job_control_signals): Use countof instead.
* lib/uniconv/u16-conv-to-enc.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
* lib/uniconv/u32-conv-to-enc.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
* lib/uniconv/u-conv-to-enc.h (FUNC): Use countof instead.
* lib/uniconv/u16-strconv-to-enc.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
* lib/uniconv/u32-strconv-to-enc.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
* lib/uniconv/u-strconv-to-enc.h (FUNC): Use countof instead.
* lib/uniname/uniname.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(unicode_name_word, unicode_name_word_lookup, unicode_code_to_index,
unicode_index_to_code, unicode_character_name, unicode_name_character):
Use countof instead.
* lib/uniwidth/width.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(uc_width): Use countof instead.
* lib/wait-process.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(slaves_allocated): Use countof instead.
* lib/gen-uni-tables.c (countof): Renamed from SIZEOF.
* modules/boot-time (Depends-on): Add stdcountof-h.
* modules/readutmp (Depends-on): Likewise.
* modules/duplocale (Depends-on): Likewise.
* modules/fatal-signal (Depends-on): Likewise.
* modules/iconv_open (Depends-on): Likewise.
* modules/term-style-control (Depends-on): Likewise.
* modules/uniconv/u16-conv-to-enc (Depends-on): Likewise.
* modules/uniconv/u32-conv-to-enc (Depends-on): Likewise.
* modules/uniconv/u16-strconv-to-enc (Depends-on): Likewise.
* modules/uniconv/u32-strconv-to-enc (Depends-on): Likewise.
* modules/uniname/uniname (Depends-on): Likewise.
* modules/uniwidth/width (Depends-on): Likewise.
* modules/wait-process (Depends-on): Likewise.
* tests/macros.h (SIZEOF): Remove macro.
* tests/**/*.[hc]: Use countof instead of SIZEOF. Include <stdcountof.h>
as needed.
* modules/**/*-tests (Depends-on): Add stdcountof-h if needed.
2026-03-02 14:35:26 +01:00
Bruno Haible 64e78e4467 tests: Use streq, part 1.
Done through sed -e 's/strcmp \([(][^()]*[)]\) == 0/streq \1/'

* tests/**/*.[hc]: Use streq instead of strcmp ... == 0.
* modules/*-tests (Dependencies): Add streq.
2026-03-01 09:44:40 +01:00
Bruno Haible 7561e64ee3 Fix link errors in unit tests.
Reported by Tom G. Christensen <tgc@jupiterrise.com>.

* modules/bitset-tests (Makefile.am): Link test-bitset against libintl.
* modules/array-map-tests (Makefile.am): Link test-array_map against
libintl.
* modules/array-set-tests (Makefile.am): Link test-array_set against
libintl.
* modules/hash-map-tests (Makefile.am): Link test-hash_map against
libintl.
* modules/hash-set-tests (Makefile.am): Link test-hash_set against
libintl.
* modules/linkedhash-map-tests (Makefile.am): Link test-linkedhash_map
against libintl.
* modules/linkedhash-set-tests (Makefile.am): Link test-linkedhash_set
against libintl.
2019-01-04 20:31:28 +01:00
Bruno Haible 8fcf37ec62 array-map: Add tests.
* tests/test-array_map.c: New file.
* modules/array-map-tests: New file.
2018-12-14 23:08:02 +01:00