Bruno Haible [Sun, 9 Aug 2020 13:58:10 +0000 (15:58 +0200)]
Use __alignof__ with clang.
* m4/stddef_h.m4 (gl_STDDEF_H): Test the alignment of max_align_t also
on clang.
* lib/alignof.h (alignof_type): Use __alignof__ also on clang.
* lib/stdalign.in.h (_Alignof): Don't activate the GCC workaround on
clang.
* lib/malloca.h (sa_alignof): Use __alignof__ also on clang.
* lib/bitset/list.c (lbitset_elt_alloc): Use __alignof__ also on clang.
* lib/bitset/table.c (tbitset_elt_alloc): Likewise.
* tests/test-stddef.c: Very the behaviour of __alignof__ also on clang.
Bruno Haible [Sun, 9 Aug 2020 13:01:23 +0000 (15:01 +0200)]
Use __typeof__ with clang.
* m4/stdint.m4 (gl_STDINT_H): Check for SIZE_MAX also on
"clang -std=gnu99".
* lib/intprops.h (_GL_HAVE___TYPEOF__): Define to 1 also on clang.
* tests/test-stdint.c (verify_same_types): Enable the check also on
clang.
Bruno Haible [Sun, 9 Aug 2020 12:51:56 +0000 (14:51 +0200)]
Add ability to emit user-defined warnings and errors with clang.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_ATTRIBUTE_ERROR,
_GL_ATTRIBUTE_WARNING using an attribute for clang.
* lib/warn-on-use.h (_GL_WARN_ON_USE, _GL_WARN_ON_USE_ATTRIBUTE,
_GL_WARN_ON_USE_CXX): Define using an attribute for clang.
* lib/cdefs.h (__warndecl, __warnattr, __errordecl): Define using an
attribute for clang.
Bruno Haible [Sun, 9 Aug 2020 10:36:37 +0000 (12:36 +0200)]
Use __builtin_signbit* with clang.
* lib/math.in.h (signbit): Use __builtin_signbit{,f,l} also on clang.
* m4/signbit.m4 (gl_SIGNBIT): Use __builtin_signbit{,f,l} also on clang.
Set REPLACE_SIGNBIT_USING_BUILTINS, not REPLACE_SIGNBIT_USING_GCC.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize
REPLACE_SIGNBIT_USING_BUILTINS, not REPLACE_SIGNBIT_USING_GCC.
* modules/math (Makefile.am): Substitute REPLACE_SIGNBIT_USING_BUILTINS,
not REPLACE_SIGNBIT_USING_GCC.
Bruno Haible [Sun, 9 Aug 2020 10:09:17 +0000 (12:09 +0200)]
Use __builtin_isnan with clang.
* lib/isnanf-nolibm.h (isnanf): Use the GCC built-in __builtin_isnan,
not __builtin_isnanf. Also on clang.
* m4/isnanf.m4 (gl_HAVE_ISNANF_NO_LIBM, gl_ISNANF_WORKS): Use the GCC
built-in __builtin_isnan, not __builtin_isnanf. Also on clang.
* lib/isnand-nolibm.h (isnand): With clang, use the GCC built-in.
* m4/isnand.m4 (gl_HAVE_ISNAND_IN_LIBM): With clang, use the GCC
built-in.
* lib/isnanl-nolibm.h (isnanf): Use the GCC built-in __builtin_isnan,
not __builtin_isnanl. Also on clang.
* m4/isnanl.m4 (gl_HAVE_ISNANL_NO_LIBM, gl_FUNC_ISNANL_WORKS): Use the
GCC built-in __builtin_isnan, not __builtin_isnanl. Also on clang.
* lib/math.in.h (__has_builtin): Remove macro.
(isnanf, gl_isnan_f): Use the GCC built-in __builtin_isnan, not
__builtin_isnanf. Also on clang.
(isnand, gl_isnan_d): With clang, use the GCC built-in.
(isnanl, gl_isnan_l): Use the GCC built-in __builtin_isnan, not
__builtin_isnanl. Also on clang.
(isnan): Use the GCC built-in __builtin_isnan in all three cases. Also
on clang.
Bruno Haible [Fri, 7 Aug 2020 21:02:21 +0000 (23:02 +0200)]
doc: Update for glibc 2.32.
* doc/glibc-functions/__libc_single_threaded.texi: New file.
* doc/glibc-functions/pthread_attr_getsigmask_np.texi: New file.
* doc/glibc-functions/pthread_attr_setsigmask_np.texi: New file.
* doc/glibc-functions/sigabbrev_np.texi: New file.
* doc/glibc-functions/sigdescr_np.texi: New file.
* doc/glibc-functions/strerrordesc_np.texi: New file.
* doc/glibc-functions/strerrorname_np.texi: New file.
* doc/gnulib.texi: Include them.
(Glibc sys/single_threaded.h): New section.
* doc/pastposix-functions/h_errno.texi: Update.
* doc/posix-functions/*.texi: Likewise.
* doc/glibc-functions/*.texi: Likewise.
Bruno Haible [Thu, 6 Aug 2020 18:55:13 +0000 (20:55 +0200)]
Consider that clang defines __OPTIMIZE__ like GCC does.
* lib/streq.h: Define the inline functions also on clang.
* lib/c-strcaseeq.h: Likewise.
* lib/c++defs.h (_GL_CXXALIASWARN_2, _GL_CXXALIASWARN1_2): Don't enable
the GCC workaround to clang.
Bruno Haible [Wed, 5 Aug 2020 17:57:21 +0000 (19:57 +0200)]
Use __builtin_ctz{,l,ll} and __builtin_ffs{,l,ll} with clang everywhere.
* lib/count-trailing-zeros.h (COUNT_TRAILING_ZEROS): Use the GCC
built-in also on clang.
* lib/ffs.c: With clang, use the GCC built-in, not <intrin.h>.
* lib/ffsl.h: Likewise. Assume GCC_BUILTIN is defined.
Bruno Haible [Wed, 5 Aug 2020 17:25:42 +0000 (19:25 +0200)]
Use __builtin_clz{,l,ll} with clang, also on Windows.
* lib/integer_length.c: With clang, use the GCC built-in, not
<intrin.h>.
* lib/integer_length_l.c: Likewise.
* lib/count-leading-zeros.h (COUNT_LEADING_ZEROS): Use the GCC built-in
also on clang.
* lib/vasnprintf.c (divide): Likewise.
Bruno Haible [Mon, 3 Aug 2020 22:13:46 +0000 (00:13 +0200)]
ffsll: Optimize for MSVC in 64-bit mode.
* lib/ffsl.h (FUNC): On MSVC, use MSVC_BUILTIN if defined.
* lib/ffsll.c (MSVC_BUILTIN): Define for MSVC in 64-bit mode.
* lib/ffsl.c (MSVC_BUILTIN): Define for MSVC.
Bruno Haible [Sun, 2 Aug 2020 18:57:11 +0000 (20:57 +0200)]
oset: Add an 'iterator_atleast' operation.
* lib/gl_array_oset.c (gl_array_indexof_atleast): New function,
extracted from gl_array_search_atleast.
(gl_array_search_atleast): Use it.
(gl_array_iterator_atleast): New function.
(gl_array_oset_implementation): Use it.
* lib/gl_anytree_oset.h (gl_tree_iterator_atleast): New function.
* lib/gl_avltree_oset.c (gl_avltree_oset_implementation): Use it.
* lib/gl_rbtree_oset.c (gl_rbtree_oset_implementation): Likewise.
* lib/gl_oset.h (struct gl_oset_implementation): Add 'iterator_atleast'
member.
(gl_oset_iterator_atleast): New function.
* lib/gl_oset.hh (gl_OSet): Add 'begin_atleast' member.
(gl_OSet::iterator): Add another auxiliary constructor.
* tests/test-array_oset.c (is_at_least, gl_sortedlist_indexof_atleast):
New functions.
(main): Test also gl_oset_iterator_atleast.
* tests/test-avltree_oset.c (is_at_least): New function.
(main): Test also gl_oset_iterator_atleast.
* tests/test-rbtree_oset.c (is_at_least): New function.
(main): Test also gl_oset_iterator_atleast.
* tests/test-oset-c++.cc (is_at_most): New function.
(main): Test also gl_OSet::begin_atleast.
Bruno Haible [Sun, 2 Aug 2020 18:19:31 +0000 (20:19 +0200)]
oset-c++, omap-c++: Remove restriction for search_atleast method.
* lib/gl_oset.hh (gl_OSet::search_atleast): Allow the threshold to be of
a different type than the element.
* lib/gl_omap.hh (gl_OMap::search_atleast): Allow the threshold to be of
a different type than the key.
Paul Eggert [Thu, 30 Jul 2020 16:27:18 +0000 (09:27 -0700)]
Work around some Oracle Studio attribute bugs
These were discovered when building bleeding-edge Emacs with
Oracle Studio.
* m4/gnulib-common.m4 (_GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_MAY_ALIAS):
Port to Oracle Studio 12.6, which mishandles __attribute__
((__cold__)) and __attribute__ ((__may_alias__)) even though
__has_attribute says they work.
Paul Eggert [Wed, 29 Jul 2020 20:39:37 +0000 (13:39 -0700)]
fsusage, regex, stat-size: remove Cray support
As near as I can make out this is actually support for UNICOS/mp,
last released 2005, and Cray hasn’t supported that for years.
* config/srclist.txt: Comment out regex.h for now.
* lib/fsusage.c (get_fs_usage):
* lib/regex.h (re_comp, re_exec):
* lib/stat-size.h (ST_NBLOCKSIZE):
Don’t worry about _CRAY.
Paul Eggert [Tue, 28 Jul 2020 00:21:51 +0000 (17:21 -0700)]
xalloc-die: don’t depend on xalloc
This removes a circular dependency, as xalloc depends on xalloc-die.
* modules/xalloc-die (Files): Add lib/xalloc.h.
(Depends-on): Remove xalloc.
Add extern-inline, stdint, xalloc-oversized (this is for xalloc.h).
Paul Eggert [Mon, 27 Jul 2020 19:57:45 +0000 (12:57 -0700)]
dfa-tests: port to MSVC
Problem reported by Gisle Vanem in:
https://lists.gnu.org/r/bug-gnulib/2020-07/msg00159.html
Also, remove an unnecessary dependency on getprogname.
* modules/dfa-tests (Depends-on): Remove getprogname.
* tests/test-dfa-match-aux.c: Do not include getprogname.h.
(exit_status): New static var.
(dfawarn): Set it instead of exiting.
Do not declare as _Noreturn, to pacify MSVC.
(main): Return exit_status.
Paul Eggert [Sun, 26 Jul 2020 16:57:47 +0000 (09:57 -0700)]
libgmp: remove dependency on havelib
* m4/libgmp.m4 (gl_LIBGMP): If gl_HAVE_MODULE_HAVELIB is not defined,
use the more-traditional AC_SEARCH_LIBS approach.
This should work better with GNU Emacs configuration,
which uses pkg-config instead of a havelib-style approach.
* modules/havelib (gl_HAVE_MODULE_HAVELIB): New witness macro.
* modules/libgmp (Depends-on): Remove havelib.
Bruno Haible [Sat, 25 Jul 2020 23:54:38 +0000 (01:54 +0200)]
sigprocmask: Small autoconf macro improvement.
* m4/signalblocking.m4 (gl_SIGNALBLOCKING): Make it possible for the
user to override the value of gl_cv_func_sigprocmask.
* m4/gnulib-common.m4 (gl_SILENT): New macro.
Bruno Haible [Sat, 25 Jul 2020 23:45:32 +0000 (01:45 +0200)]
Small autoconf macro improvements.
* m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Make it possible for the user to
override the value of gl_cv_func_working_mktime.
* m4/multiarch.m4 (gl_MULTIARCH): Show a line "checking whether the
compiler produces multi-arch binaries..." in the configure output.
* m4/size_max.m4 (gl_SIZE_MAX): When not found, say "no".
* m4/parse-datetime.m4 (gl_C_COMPOUND_LITERALS): Improve indentation.
Paul Eggert [Fri, 24 Jul 2020 19:20:14 +0000 (12:20 -0700)]
parse-datetime: modernize doc
* doc/parse-datetime.texi: Use more-current examples.
Don’t lead with 32-bit time_t, as it’s on its way out.
Capitalize “Epoch” to be consistent with POSIX.
Bruno Haible [Tue, 21 Jul 2020 16:09:35 +0000 (18:09 +0200)]
aligned-malloc: Optionally use aligned_alloc.
* lib/aligned-malloc.h: Verify the alignment.
(aligned_malloc): Use aligned_alloc as an alternative.
* modules/aligned-malloc (configure.ac): Test for aligned_alloc.
* doc/posix-functions/aligned_alloc.texi: Mention the modules
'aligned-malloc' and 'pagealign_alloc'.
Bruno Haible [Tue, 21 Jul 2020 08:03:42 +0000 (10:03 +0200)]
aligned-malloc: New module.
* lib/aligned-malloc.h: New file.
* m4/malloc-align.m4: New file.
* modules/aligned-malloc: New file.
* doc/posix-functions/posix_memalign.texi: Mention the new module.
* doc/glibc-functions/memalign.texi: Likewise.
Paul Eggert [Wed, 15 Jul 2020 17:57:05 +0000 (10:57 -0700)]
md5, sha1, sha256, sha512: pacify Autoconf 2.70
* m4/gl-openssl.m4 (gl_CRYPTO_CHECK): Use m4_if rather than a
shell if, so that the argument to AC_CHECK_HEADERS is
a simple string that does not require shell evaluation.
This fixes a warning generated by Autoconf 2.69b.
Bruno Haible [Thu, 9 Jul 2020 15:28:48 +0000 (17:28 +0200)]
unicodeio: Fix wrong result on Solaris 11.
Reported by Kiyoshi Kanazawa <yoi_no_myoujou@yahoo.co.jp>
via Akim Demaille <akim.demaille@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-07/msg00036.html>.
* lib/unicodeio.c (unicode_to_mb): Handle question mark fallback
characters on Solaris.
* tests/test-unicodeio.c (main): In the "C" locale, expect either the
UTF-8 output or the specified fallback.
Bruno Haible [Wed, 8 Jul 2020 18:01:36 +0000 (20:01 +0200)]
unicodeio: Add tests.
* tests/test-unicodeio.c: New file.
* tests/test-unicodeio1.sh: New file.
* tests/test-unicodeio2.sh: New file.
* tests/test-unicodeio3.sh: New file.
* modules/unicodeio-tests: New file.