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.
Paul Eggert [Tue, 7 Jul 2020 01:54:11 +0000 (18:54 -0700)]
libgmp: new module
The idea is to let programs simply include <gmp.h>, and
so long as they live within the mini-gmp subset they need
not worry about whether the GMP libraries are installed.
* MODULES.html.sh: Mention it.
* config/srclist.txt: Mention files copied from GMP source.
* config/srclistvars.sh (GMP): New var.
* lib/mini-gmp-gnulib.c, m4/libgmp.m4, modules/libgmp:
* modules/libgmp-tests, tests/test-libgmp.c: New files.
* lib/mini-gmp.c, lib/mini-gmp.h: New files, copied from GMP.
Bruno Haible [Sun, 5 Jul 2020 16:06:13 +0000 (18:06 +0200)]
basename-lgpl: New module.
* lib/basename-lgpl.h: New file, based on lib/dirname.h and
lib/basename-lgpl.c.
* lib/basename-lgpl.c: Include basename-lgpl.h, not dirname.h. Include
<stdbool.h>, filename.h.
(last_component): Rename a local variable.
* lib/dirname.h: Include basename-lgpl.h.
(DOUBLE_SLASH_IS_DISTINCT_ROOT): Remove macro.
(last_component, base_len): Remove declarations.
* modules/basename-lgpl: New file.
* modules/dirname-lgpl (Files): Remove lib/basename-lgpl.c.
(Depends-on): Add basename-lgpl. Remove double-slash-root.
(Makefile.am): Don't compile basename-lgpl.c.
* doc/posix-functions/basename.texi: Mention the module 'basename-lgpl',
not 'dirname'.
Bruno Haible [Sun, 5 Jul 2020 10:27:29 +0000 (12:27 +0200)]
supersede: Add tests.
* tests/test-supersede.c: New file.
* tests/test-supersede-open.h: New file.
* tests/test-supersede-fopen.h: New file.
* modules/supersede-tests: New file.
Bruno Haible [Sat, 4 Jul 2020 13:18:20 +0000 (15:18 +0200)]
clean-temp: Add support for temporary files with unpredictable names.
* lib/clean-temp.h (gen_register_open_temp): New declaration.
* lib/clean-temp.c: Include tempname.h.
(gen_register_open_temp): New function.
* modules/tempname (configure.ac): Define a module indicator.
Bruno Haible [Sat, 4 Jul 2020 13:17:32 +0000 (15:17 +0200)]
clean-temp: Add support for temporary files anywhere in the file system.
* lib/clean-temp.h (register_temporary_file, unregister_temporary_file,
cleanup_temporary_file): New declarations.
* lib/clean-temp.c (file_cleanup_list_lock, file_cleanup_list): New
variables.
(dir_cleanup_list_lock): Renamed from cleanup_list_lock.
(dir_cleanup_list): Renamed from cleanup_list.
(cleanup_action): Process the file_cleanup_list as well.
(do_init_clean_temp): New function.
(clean_temp_once): New variable.
(init_clean_temp): New function.
(create_temp_dir): Invoke it.
(register_temporary_file, unregister_temporary_file,
cleanup_temporary_file): New functions.
(do_unlink, do_rmdir): Remove 'dir' argument. Add 'cleanup_verbose'
argument.
Bruno Haible [Sat, 4 Jul 2020 12:39:09 +0000 (14:39 +0200)]
clean-temp: Make multithread-safe, part 2.
* lib/fatal-signal.h: Include <signal.h>.
(get_fatal_signal_set): New declaration.
* lib/fatal-signal.c (get_fatal_signal_set): New function.
* lib/clean-temp.c: Include asyncsafe-spin.h, gl_linked_list.h.
(struct closeable_fd): New type.
(fatal_signal_set): New variable.
(init_fatal_signal_set): New function.
(asyncsafe_close, asyncsafe_fclose_variant): New functions.
(cleanup_action): Invoke asyncsafe_close instead of close.
(create_temp_dir): Invoke init_fatal_signal_set.
(register_fd): Use a plain linked list. Add a 'struct closeable_fd *'
element.
(unregister_fd): Remove function.
(close_temp): Cleanup descriptors list on the fly. Invoke
init_fatal_signal_set. Invoke asyncsafe_close instead of close.
(fclose_variant_temp): New function.
(fclose_temp, fwriteerror_temp, close_stream_temp): Use it.
* modules/clean-temp (Depends-on): Add asyncsafe-spin, linked-list.
Bruno Haible [Sat, 4 Jul 2020 12:39:03 +0000 (14:39 +0200)]
clean-temp: Make multithread-safe, part 1.
* lib/clean-temp.c: Include glthread/lock.h.
(cleanup_list_lock): New variable.
(register_temp_file, unregister_temp_file, register_temp_subdir,
unregister_temp_subdir, cleanup_temp_dir_contents): Use it.
(create_temp_dir): Likewise. Don't free the old array.
(descriptors_lock): New variable.
(register_fd, unregister_fd): Use it.
* modules/clean-temp (Depends-on): Add lock.
Bruno Haible [Sat, 4 Jul 2020 10:43:26 +0000 (12:43 +0200)]
fatal-signal: Make multithread-safe.
* lib/fatal-signal.c (init_fatal_signals): Add comment.
(do_init_fatal_signal_set): New function, extracted from
init_fatal_signal_set.
(fatal_signal_set_once): New variable.
(init_fatal_signal_set): Use gl_once.
Paul Eggert [Thu, 2 Jul 2020 00:00:51 +0000 (17:00 -0700)]
manywarnings: improve port to GCC 10.1
* build-aux/gcc-warning.spec: Also list warnings that are default
or are enabled by already-given flags. This lets us speed up
checking for attributes, and makes the generated compilation
commands shorter. Add -Wanalyzer-too-complex (too much noise).
* m4/manywarnings.m4 (gl_MANYWARN_COMPLEMENT)
(gl_MANYWARN_ALL_GCC): Use gl_AS_VAR_APPEND to append
to shell variables that may have long values.
(gl_MANYWARN_ALL_GCC): Omit flags that are default or are
consequences of other flags, to speed up checking and
shorten commands.
Bruno Haible [Wed, 1 Jul 2020 21:00:44 +0000 (23:00 +0200)]
asyncsafe-spin: Add tests.
* tests/test-asyncsafe-spin1.c: New file.
* tests/test-asyncsafe-spin2.c: New file, based on tests/test-lock.c and
tests/test-pthread-spin.c.
* modules/asyncsafe-spin-tests: New file.