]> Savannah Git Hosting - gnulib.git/log
gnulib.git
4 years agofchmodat: Use /proc on Cygwin
Ken Brown [Thu, 23 Jul 2020 17:44:22 +0000 (13:44 -0400)]
fchmodat: Use /proc on Cygwin

* lib/fchmodat.c (fchmodat): Use /proc on Cygwin.

4 years agoaligned-malloc: Optionally use aligned_alloc.
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'.

4 years agoaligned-malloc: Add tests.
Bruno Haible [Tue, 21 Jul 2020 08:04:36 +0000 (10:04 +0200)]
aligned-malloc: Add tests.

* tests/test-aligned-malloc.c: New file.
* modules/aligned-malloc-tests: New file.

4 years agoaligned-malloc: New module.
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.

4 years agointtypes: Fix PRI*PTR and SCN*PTR on 64-bit native Windows.
Bruno Haible [Tue, 21 Jul 2020 07:53:29 +0000 (09:53 +0200)]
inttypes: Fix PRI*PTR and SCN*PTR on 64-bit native Windows.

* m4/inttypes.m4 (gl_INTTYPES_PRI_SCN): On 64-bit native Windows, make
sure PRIPTR_PREFIX is defined to "ll", not "l".

4 years agoprintf-posix: Make an autoconf test more future-proof.
Bruno Haible [Tue, 21 Jul 2020 07:48:09 +0000 (09:48 +0200)]
printf-posix: Make an autoconf test more future-proof.

* m4/printf.m4 (gl_PRINTF_DIRECTIVE_N): Include <inttypes.h> before
using uintptr_t.

4 years agolist, oset, omap: Relicense some of the container modules under LGPLv2+.
Bruno Haible [Mon, 20 Jul 2020 19:22:12 +0000 (21:22 +0200)]
list, oset, omap: Relicense some of the container modules under LGPLv2+.

* modules/list (License): Change to LGPLv2+.
* modules/array-list (License): Likewise.
* modules/carray-list (License): Likewise.
* modules/linked-list (License): Likewise.
* modules/avltree-list (License): Likewise.
* modules/rbtree-list (License): Likewise.
* modules/oset (License): Likewise.
* modules/array-oset (License): Likewise.
* modules/avltree-oset (License): Likewise.
* modules/rbtree-oset (License): Likewise.
* modules/omap (License): Likewise.
* modules/array-omap (License): Likewise.
* modules/avltree-omap (License): Likewise.
* modules/rbtree-omap (License): Likewise.

4 years agooset: Add an 'update' operation.
Bruno Haible [Mon, 20 Jul 2020 18:06:29 +0000 (20:06 +0200)]
oset: Add an 'update' operation.

* lib/gl_array_oset.c (gl_array_update): New function.
(gl_array_oset_implementation): Use it.
* lib/gl_avltree_omap.c (NODE_PAYLOAD_DISPOSE): Add parameters.
* lib/gl_rbtree_omap.c (NODE_PAYLOAD_DISPOSE): Add parameters.
* lib/gl_avltree_ordered.h (gl_tree_add_node_before): New function,
extracted from gl_tree_nx_add_before.
(gl_tree_nx_add_before): Invoke it.
(gl_tree_add_node_after): New function, extracted from
gl_tree_nx_add_after.
(gl_tree_nx_add_after): Invoke it.
(gl_tree_remove_node_no_free): New function, extracted from
gl_tree_remove_node.
(gl_tree_remove_node): Invoke it.
* lib/gl_rbtree_ordered.h (gl_tree_add_node_before): New function,
extracted from gl_tree_nx_add_before.
(gl_tree_nx_add_before): Invoke it.
(gl_tree_add_node_after): New function, extracted from
gl_tree_nx_add_after.
(gl_tree_nx_add_after): Invoke it.
(gl_tree_remove_node_no_free): New function, extracted from
gl_tree_remove_node.
(gl_tree_remove_node): Invoke it.
* lib/gl_anytree_oset.h (gl_tree_next_node): New function, extracted
from gl_tree_iterator_next.
(gl_tree_iterator_next): Invoke it.
(gl_tree_prev_node, gl_tree_update): New functions.
* lib/gl_avltree_oset.c (NODE_PAYLOAD_DISPOSE): Add parameters.
(gl_avltree_oset_implementation): Use gl_tree_update.
* lib/gl_rbtree_oset.c (NODE_PAYLOAD_DISPOSE): Add parameters.
(gl_rbtree_oset_implementation): Use gl_tree_update.
* lib/gl_oset.h (struct gl_oset_implementation): Add 'update' member.
(gl_oset_update): New function.
* lib/gl_oset.hh (gl_OSet): Add 'update' member.
* modules/avltree-oset (configure.ac): Require AC_C_INLINE.
* modules/rbtree-oset (configure.ac): Likewise.
* tests/test-oset-update.h: New file.
* tests/test-array_oset.c: Include test-oset-update.h.
(main): Invoke test_update.
* tests/test-avltree_oset.c: Likewise.
* tests/test-rbtree_oset.c: Likewise.
* modules/array-oset-tests (Files): Add tests/test-oset-update.h.
* modules/avltree-oset-tests (Files): Likewise.
* modules/rbtree-oset-tests (Files): Likewise.
* tests/test-oset-c++.cc (action): New function.
(main): Test the 'update' member function.

4 years agomd5, sha1, sha256, sha512: pacify Autoconf 2.70
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.

4 years agoautoupdate
Karl Berry [Mon, 13 Jul 2020 14:17:03 +0000 (07:17 -0700)]
autoupdate

4 years agolibgmp: Avoid warning when --without-libgmp is used.
Bruno Haible [Sun, 12 Jul 2020 21:56:29 +0000 (23:56 +0200)]
libgmp: Avoid warning when --without-libgmp is used.

* lib/mini-gmp-gnulib.c: Ignore -Wsuggest-attribute=malloc only for
GCC >= 8, not for GCC >= 4.6.

4 years agolibgmp: Link to the correct shared library.
Bruno Haible [Sun, 12 Jul 2020 21:47:52 +0000 (23:47 +0200)]
libgmp: Link to the correct shared library.

* m4/libgmp.m4 (gl_LIBGMP): Invoke AC_LIB_HAVE_LINKFLAGS.
* modules/libgmp (Depends-on): Add havelib.
(Link): Mention $(LIBGMP) and $(LTLIBGMP).
* modules/libgmp-tests (Makefile.am): Link test-libgmp with $(LIBGMP).

4 years agolibgmp tests: Add some safety checks.
Bruno Haible [Sun, 12 Jul 2020 20:51:22 +0000 (22:51 +0200)]
libgmp tests: Add some safety checks.

* modules/libgmp-tests (Depends-on): Add verify.
* tests/test-libgmp.c: Verify GMP_NUMB_BITS value.
(main): Verify that gmp.h and libgmp versions match.

4 years agoAdd a copyright header.
Bruno Haible [Sun, 12 Jul 2020 20:23:30 +0000 (22:23 +0200)]
Add a copyright header.

* tests/test-libgmp.c: Add a copyright header.

4 years agoautoupdate
Karl Berry [Sun, 12 Jul 2020 15:13:33 +0000 (08:13 -0700)]
autoupdate

4 years agoautoupdate
Karl Berry [Sat, 11 Jul 2020 15:09:12 +0000 (08:09 -0700)]
autoupdate

4 years agoautoupdate
Karl Berry [Fri, 10 Jul 2020 15:48:34 +0000 (08:48 -0700)]
autoupdate

4 years agounicodeio: Fix wrong result on NetBSD.
Bruno Haible [Fri, 10 Jul 2020 07:51:52 +0000 (09:51 +0200)]
unicodeio: Fix wrong result on NetBSD.

* lib/unicodeio.c (unicode_to_mb): Handle question mark fallback
characters also on NetBSD.

4 years agounicodeio: Fix wrong result on Solaris 11.
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.

4 years agounicodeio: Add tests.
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.

4 years agounicodeio: Document link requirements.
Bruno Haible [Wed, 8 Jul 2020 18:00:00 +0000 (20:00 +0200)]
unicodeio: Document link requirements.

* modules/unicodeio (Link): New section.

4 years agodoc: Remove support for some very old platforms.
Bruno Haible [Wed, 8 Jul 2020 01:21:36 +0000 (03:21 +0200)]
doc: Remove support for some very old platforms.

* doc/posix-functions/memcmp.texi: Don't mention "older platforms".
* doc/posix-functions/memcpy.texi: Likewise.
* doc/posix-functions/memmove.texi: Likewise.
* doc/posix-functions/memset.texi: Likewise.
* doc/posix-functions/getcwd.texi: Likewise.

4 years agomemchr: Remove support for some very old platforms.
Bruno Haible [Wed, 8 Jul 2020 01:19:54 +0000 (03:19 +0200)]
memchr: Remove support for some very old platforms.

* m4/memchr-obsolete.m4: Remove file.
* modules/memchr-obsolete: Remove file.
* m4/memchr.m4 (gl_FUNC_MEMCHR): Assume module 'memchr-obsolete' is
absent. Don't define HAVE_MEMCHR.
* lib/string.in.h (memchr): Assume HAVE_MEMCHR is 1.
* modules/memchr (Depends-on): Remove memchr-obsolete.
(configure.ac): Assume HAVE_MEMCHR is 1.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Don't initialize
HAVE_MEMCHR.
* modules/string (Makefile.am): Don't substitute HAVE_MEMCHR.
* doc/posix-functions/memchr.texi: Don't mention module
'memchr-obsolete'.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Assume HAVE_MEMCHR is 1.
* m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Assume HAVE_MEMCHR is 1.
* modules/strnlen (Depends-on): Remove memchr-obsolete.

4 years agodup2: Remove support for some very old platforms.
Bruno Haible [Wed, 8 Jul 2020 00:52:09 +0000 (02:52 +0200)]
dup2: Remove support for some very old platforms.

* m4/dup2-obsolete.m4: Remove file.
* modules/dup2-obsolete: Remove file.
* m4/dup2.m4 (gl_FUNC_DUP2): Assume module 'dup2-obsolete' is absent.
Don't define HAVE_DUP2.
* lib/unistd.in.h (dup2): Assume HAVE_DUP2 is 1.
* lib/dup2.c: Likewise.
* modules/dup2 (Depends-on, configure.ac): Likewise.
(Depends-on): Remove dup2-obsolete.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Don't initialize HAVE_DUP2.
* modules/unistd (Makefile.am): Don't substitute HAVE_DUP2.
* doc/posix-functions/dup2.texi: Don't mention module 'dup2-obsolete'.

4 years agocanonicalize: Trim module dependencies.
Bruno Haible [Wed, 8 Jul 2020 00:07:38 +0000 (02:07 +0200)]
canonicalize: Trim module dependencies.

* lib/hash-triple.h: Group declarations.
* lib/hash-triple-simple.c: New file, extracted from lib/hash-triple.c.
* lib/hash-triple.c: Don't include <stdlib.h>, <string.h>, hash-pjw.h.
(STREQ): Remove macro.
(triple_hash, triple_compare_ino_str, triple_free): Remove functions.
* modules/hash-triple-simple: New file, based on modules/hash-triple.
* modules/hash-triple (Files): Remove lib/hash-triple.h.
(Depends-on): Add hash-triple-simple. Remove hash-pjw.
* modules/canonicalize (Depends-on): Remove hash-triple. Add
hash-triple-simple.
* modules/file-set (Depends-on): Likewise.

4 years agoClarify dependencies to double-slash-root.
Bruno Haible [Tue, 7 Jul 2020 23:37:19 +0000 (01:37 +0200)]
Clarify dependencies to double-slash-root.

* modules/canonicalize (Files): Remove m4/double-slash-root.m4.
(Depends-on): Add double-slash-root.
* modules/canonicalize-lgpl (Depends-on): Add double-slash-root.
* modules/dirname-lgpl (Depends-on): Add double-slash-root.

4 years agolibgmp: new module
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.

4 years agoUntabify.
Bruno Haible [Sun, 5 Jul 2020 19:39:35 +0000 (21:39 +0200)]
Untabify.

4 years agomkancesdirs: Trim module dependencies.
Bruno Haible [Sun, 5 Jul 2020 19:14:05 +0000 (21:14 +0200)]
mkancesdirs: Trim module dependencies.

* lib/mkancesdirs.c: Include filename.h instead of dirname.h.
* modules/mkancesdirs (Depends-on): Remove dirname-lgpl. Add filename.

4 years agogetprogname: Trim module dependencies.
Bruno Haible [Sun, 5 Jul 2020 19:12:33 +0000 (21:12 +0200)]
getprogname: Trim module dependencies.

* lib/getprogname.c: Include basename-lgpl.h instead of dirname.h.
* modules/getprogname (Depends-on): Remove dirname-lgpl. Add
basename-lgpl.

4 years agofilenamecat-lgpl: Trim module dependencies.
Bruno Haible [Sun, 5 Jul 2020 19:10:11 +0000 (21:10 +0200)]
filenamecat-lgpl: Trim module dependencies.

* lib/filenamecat-lgpl.c: Include basename-lgpl.h, filename.h instead of
dirname.h.
* modules/filenamecat-lgpl (Depends-on): Remove dirname-lgpl. Add
basename-lgpl, filename.

4 years agobackupfile, backup-rename: Trim module dependencies.
Bruno Haible [Sun, 5 Jul 2020 19:07:46 +0000 (21:07 +0200)]
backupfile, backup-rename: Trim module dependencies.

* lib/backupfile.c: Include basename-lgpl.h instead of dirname.h.
* modules/backupfile (Depends-on): Remove dirname-lgpl. Add
basename-lgpl.
* modules/backup-rename (Depends-on): Likewise.

4 years agoargp: Trim module dependencies.
Bruno Haible [Sun, 5 Jul 2020 19:05:21 +0000 (21:05 +0200)]
argp: Trim module dependencies.

* lib/argp-namefrob.h: Include basename-lgpl.h instead of dirname.h.
* modules/argp (Depends-on): Remove dirname-lgpl. Add basename-lgpl.

4 years agobasename-lgpl: New module.
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'.

4 years agodirname, dirname-lgpl: Simplify.
Bruno Haible [Sun, 5 Jul 2020 16:05:31 +0000 (18:05 +0200)]
dirname, dirname-lgpl: Simplify.

* m4/dirname.m4: Remove file.
* modules/dirname (configure.ac): Don't invoke gl_DIRNAME.
* modules/dirname-lgpl (Files): Remove m4/dirname.m4.
(configure.ac): Don't invoke gl_DIRNAME_LGPL.

4 years agotests: avoid shadowing warning
Bernhard Voelker [Thu, 2 Jul 2020 21:11:52 +0000 (23:11 +0200)]
tests: avoid shadowing warning

* tests/test-memchr.c (main): Give page_boundary variable a tight scope.

4 years agosupersede: Add tests.
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.

4 years agosupersede: New module.
Bruno Haible [Sun, 5 Jul 2020 10:27:24 +0000 (12:27 +0200)]
supersede: New module.

* lib/supersede.h: New file.
* lib/supersede.c: New file.
* m4/supersede.m4: New file.
* modules/supersede: New file.

4 years agoAdd some copyright headers.
Bruno Haible [Sun, 5 Jul 2020 09:07:03 +0000 (11:07 +0200)]
Add some copyright headers.

* lib/dev-ino.h: Add copyright header.
* lib/di-set.h: Likewise.
* lib/fchown-stub.c: Likewise.
* lib/file-set.h: Likewise.
* lib/hash-triple.h: Likewise.
* lib/idcache.h: Likewise.
* lib/ino-map.h: Likewise.
* lib/mkancesdirs.h: Likewise.
* lib/scratch_buffer.h: Likewise.
* lib/se-context.in.h: Likewise.
* lib/stdopen.h: Likewise.
* lib/userspec.h: Likewise.

4 years agogetrandom: Relicense under LGPLv2+.
Bruno Haible [Sat, 4 Jul 2020 16:24:45 +0000 (18:24 +0200)]
getrandom: Relicense under LGPLv2+.

Paul Eggert's approval is in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-07/msg00023.html>.

* modules/getrandom (License): Change to LGPLv2+.

4 years agogetumask: Add tests.
Bruno Haible [Sat, 4 Jul 2020 16:16:06 +0000 (18:16 +0200)]
getumask: Add tests.

* tests/test-getumask.c: New file.
* modules/getumask-tests: New file.

4 years agogetumask: New module.
Bruno Haible [Sat, 4 Jul 2020 16:14:46 +0000 (18:14 +0200)]
getumask: New module.

* lib/sys_stat.in.h (getumask): New declaration.
* lib/getumask.c: New file.
* m4/getumask.m4: New file.
* m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Test whether getumask is
declared.
(gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_GETUMASK, HAVE_GETUMASK.
* modules/sys_stat (Makefile.am): Substitute GNULIB_GETUMASK,
HAVE_GETUMASK.
* modules/getumask: New file.
* tests/test-sys_stat-c++.cc (getumask): Check signature.
* doc/glibc-functions/getumask.texi: New file.
* doc/gnulib.texi (Glibc sys/stat.h): Include it.

4 years agoclean-temp: Add support for temporary files with given mode.
Bruno Haible [Sat, 4 Jul 2020 16:06:52 +0000 (18:06 +0200)]
clean-temp: Add support for temporary files with given mode.

* lib/clean-temp.h (gen_register_open_temp): Add mode argument.
* lib/clean-temp.c (struct try_create_file_params): New type.
(try_create_file): New function.
(gen_register_open_temp): Add mode argument. Use try_tempname instead of
gen_tempname.

4 years agoclean-temp: Document limitations.
Bruno Haible [Sat, 4 Jul 2020 13:22:33 +0000 (15:22 +0200)]
clean-temp: Document limitations.

* lib/clean-temp.h: Document limitations.

4 years agoclean-temp: Add support for temporary files with unpredictable names.
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.

4 years agoclean-temp: Add support for temporary files anywhere in the file system.
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.

4 years agoclean-temp: Improve comments.
Bruno Haible [Sat, 4 Jul 2020 12:52:27 +0000 (14:52 +0200)]
clean-temp: Improve comments.

* lib/clean-temp.h (open_temp, fopen_temp, close_temp, fclose_temp,
fwriteerror_temp, close_stream_temp): Clarify intended use.
* lib/clean-temp.c: Likewise.

4 years agoclean-temp: Fix last commit.
Bruno Haible [Sat, 4 Jul 2020 12:51:46 +0000 (14:51 +0200)]
clean-temp: Fix last commit.

4 years agoclean-temp: Make multithread-safe, part 2.
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.

4 years agoclean-temp: Make multithread-safe, part 1.
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.

4 years agofatal-signal: Make multithread-safe.
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.

4 years agogetrandom: Fix compilation error on native Windows (regression from 2020-06-28).
Bruno Haible [Sat, 4 Jul 2020 02:00:01 +0000 (04:00 +0200)]
getrandom: Fix compilation error on native Windows (regression from 2020-06-28).

* lib/getrandom.c: Don't include <ntdef.h>. Instead, define NTSTATUS.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Include <windows.h> before
<bcrypt.h>.

4 years agodfa tests: Follow common file naming conventions.
Bruno Haible [Fri, 3 Jul 2020 16:49:18 +0000 (18:49 +0200)]
dfa tests: Follow common file naming conventions.

* tests/test-dfa-match-aux.c: Renamed from tests/dfa-match-aux.c.
* tests/test-dfa-match.sh: Renamed from tests/dfa-match.sh. Update.
* tests/test-dfa-invalid-char-class.sh: Renamed from
tests/dfa-invalid-char-class.sh. Update.
* modules/dfa-tests (Files, Makefile.am): Update.

4 years agoasyncsafe-spin: Use GCC extended asm syntax for SunStudio 12 compiler.
Bruno Haible [Fri, 3 Jul 2020 10:35:45 +0000 (12:35 +0200)]
asyncsafe-spin: Use GCC extended asm syntax for SunStudio 12 compiler.

* lib/asyncsafe-spin.c (memory_barrier, atomic_compare_and_swap): Use
the GCC extended asm syntax also for the Sun Studio 12 compilers.

4 years agoasyncsafe-spin: Reduce code duplication.
Bruno Haible [Fri, 3 Jul 2020 10:27:37 +0000 (12:27 +0200)]
asyncsafe-spin: Reduce code duplication.

* lib/asyncsafe-spin.c: (do_lock, do_unlock): New functions.
(asyncsafe_spin_lock, asyncsafe_spin_unlock): Use them.
* modules/asyncsafe-spin (configure.ac): Require AC_C_INLINE.

4 years agolchmod: Simplify after 2020-02-22 change.
Bruno Haible [Fri, 3 Jul 2020 10:18:34 +0000 (12:18 +0200)]
lchmod: Simplify after 2020-02-22 change.

* m4/lchmod.m4 (gl_FUNC_LCHMOD): Don't require AC_C_INLINE.

4 years agogen-uni-tables: Make sure the compiler does not barf on 'inline'.
Bruno Haible [Fri, 3 Jul 2020 10:12:02 +0000 (12:12 +0200)]
gen-uni-tables: Make sure the compiler does not barf on 'inline'.

* modules/gen-uni-tables (configure.ac): Require AC_C_INLINE.

4 years agodfa: Make sure the compiler does not barf on 'inline'.
Bruno Haible [Fri, 3 Jul 2020 10:09:13 +0000 (12:09 +0200)]
dfa: Make sure the compiler does not barf on 'inline'.

* modules/dfa (configure.ac): Require AC_C_INLINE.

4 years agobitset: Make sure the compiler does not barf on 'inline'.
Bruno Haible [Fri, 3 Jul 2020 10:06:17 +0000 (12:06 +0200)]
bitset: Make sure the compiler does not barf on 'inline'.

* modules/bitset (configure.ac): New section.

4 years agomanywarnings: improve port to GCC 10.1
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.

4 years agotests: pacify gcc -fanalyzer on zerosize_ptr
Paul Eggert [Wed, 1 Jul 2020 23:45:41 +0000 (16:45 -0700)]
tests: pacify gcc -fanalyzer on zerosize_ptr

* tests/test-memcasecmp.c (main):
* tests/test-memchr.c (main):
* tests/test-memchr2.c (main):
* tests/test-memcmp.c (main):
* tests/test-memmem.c (main):
* tests/test-memrchr.c (main):
* tests/unistr/test-chr.h (main):
* tests/unistr/test-cmp.h (test_cmp):
Check whether zerosize_ptr returns NULL before using it.
This pacifies GCC 10.1’s new fanalyzer option, and matches
other uses of zerosize_ptr.

4 years agoasyncsafe-spin: Add tests.
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.

4 years agoasyncsafe-spin: New module.
Bruno Haible [Wed, 1 Jul 2020 20:59:08 +0000 (22:59 +0200)]
asyncsafe-spin: New module.

* lib/asyncsafe-spin.h: New file.
* lib/asyncsafe-spin.c: New file, based on lib/pthread-spin.c.
* modules/asyncsafe-spin: New file.

4 years agowindows-spin: Fix race condition on multiprocessor systems.
Bruno Haible [Wed, 1 Jul 2020 20:55:50 +0000 (22:55 +0200)]
windows-spin: Fix race condition on multiprocessor systems.

* lib/windows-spin.c (glwthread_spin_init): Add a memory barrier.

4 years agopthread-spin: Add optimized fallback for GCC versions >= 4.1, < 4.7.
Bruno Haible [Wed, 1 Jul 2020 20:52:41 +0000 (22:52 +0200)]
pthread-spin: Add optimized fallback for GCC versions >= 4.1, < 4.7.

* lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock,
pthread_spin_trylock, pthread_spin_unlock): For GCC >= 4.1, < 4.7, use
an implementation based on other GCC built-ins.

4 years agopthread-spin: Optimize fallback for GCC versions >= 4.7.
Bruno Haible [Wed, 1 Jul 2020 20:49:05 +0000 (22:49 +0200)]
pthread-spin: Optimize fallback for GCC versions >= 4.7.

* lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock,
pthread_spin_trylock, pthread_spin_unlock): Use a lock word instead of a
lock byte.

4 years agopthread-spin: Add error checking.
Bruno Haible [Wed, 1 Jul 2020 20:13:27 +0000 (22:13 +0200)]
pthread-spin: Add error checking.

* lib/pthread-spin.c: Include <stdbool.h>.
(pthread_spin_init, pthread_spin_lock, pthread_spin_trylock,
pthread_spin_unlock) [GCC>=4.7]: Prefer an implementation that verifies
the unlocks.
* modules/pthread-spin (Depends-on): Add stdbool.

4 years agopthread-spin: Add tests.
Bruno Haible [Wed, 1 Jul 2020 20:06:45 +0000 (22:06 +0200)]
pthread-spin: Add tests.

* tests/test-pthread-spin.c: New file, based on tests/test-lock.c.
* modules/pthread-spin-tests: New file.

4 years agotests: Reduce code duplication.
Bruno Haible [Wed, 1 Jul 2020 20:06:27 +0000 (22:06 +0200)]
tests: Reduce code duplication.

* tests/atomic-int-posix.h: New file, extracted from
tests/test-pthread-mutex.c.
* tests/test-pthread-mutex.c: Include it. Remove the corresponding code.
* tests/test-pthread-rwlock.c: Likewise.
* modules/pthread-mutex-tests (Files): Add tests/atomic-int-posix.h.
* modules/pthread-rwlock-tests (Files): Likewise.

4 years agotests: Refactor.
Bruno Haible [Wed, 1 Jul 2020 20:06:13 +0000 (22:06 +0200)]
tests: Refactor.

* tests/atomic-int-isoc.h: New file, extracted from tests/test-mtx.c.
* tests/test-mtx.c: Include it. Remove the corresponding code.
* modules/mtx-tests (Files): Add tests/atomic-int-isoc.h.

4 years agotests: Refactor.
Bruno Haible [Wed, 1 Jul 2020 20:05:15 +0000 (22:05 +0200)]
tests: Refactor.

* tests/atomic-int-gnulib.h: New file, extracted from tests/test-lock.c.
* tests/test-lock.c: Include it. Remove the corresponding code.
* modules/lock-tests (Files): Add tests/atomic-int-gnulib.h.

4 years agosys_socket: Don't define socklen_t if it is already defined on mingw.
Bruno Haible [Tue, 30 Jun 2020 00:26:45 +0000 (02:26 +0200)]
sys_socket: Don't define socklen_t if it is already defined on mingw.

Reported by Keith Marshall <keith.d.marshall@ntlworld.com> in
<https://savannah.gnu.org/bugs/?57725>,
by Rahul Das <bokul_4u@yahoo.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-04/msg00081.html>,
and by Eli Zaretskii <eliz@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-06/msg00068.html>.

* lib/sys_socket.in.h (socklen_t): Remove definition.

4 years agoautoupdate
Paul Eggert [Tue, 30 Jun 2020 00:39:54 +0000 (17:39 -0700)]
autoupdate

4 years ago* top/maint.mk: Pacify Autoconf TAB-8-space rule.
Paul Eggert [Mon, 29 Jun 2020 23:37:14 +0000 (16:37 -0700)]
* top/maint.mk: Pacify Autoconf TAB-8-space rule.

4 years agoalloca-opt: Fix warning on mingw.
Bruno Haible [Mon, 29 Jun 2020 22:54:54 +0000 (00:54 +0200)]
alloca-opt: Fix warning on mingw.

Reported and solution by Eli Zaretskii <eliz@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-06/msg00069.html>.

* lib/alloca.in.h: On mingw, include <alloca.h> and then test again
whether alloca is defined.

4 years agogetrandom: do not depend on ‘open’ on mingw
Paul Eggert [Sun, 28 Jun 2020 20:18:11 +0000 (13:18 -0700)]
getrandom: do not depend on ‘open’ on mingw

Similarly for at-internal, getloadavg.  These modules do not call
the ‘open’ function when they are compiled on mingw.  On mingw,
this avoids having to compile open.c when building Emacs, which
does its own thing with ‘open’.
* modules/at-internal, modules/getloadavg, modules/getrandom:
(Depends-on): Don’t depend on ‘open’ on mingw.
(Depends-on): Require AC_CANONICAL_HOST, for host_os.
* modules/getloadavg (Depends-on):
Depend on intprops, open, stdbool, stdlib only if compiling
getloadavg.c.

4 years agodoc: Add a note about sigprocmask vs. pthread_sigmask.
Bruno Haible [Sun, 28 Jun 2020 20:10:32 +0000 (22:10 +0200)]
doc: Add a note about sigprocmask vs. pthread_sigmask.

* doc/posix-functions/sigprocmask.texi: Add note.

4 years agogetrandom: Fix compilation errors on older versions of mingw.
Bruno Haible [Sun, 28 Jun 2020 17:04:03 +0000 (19:04 +0200)]
getrandom: Fix compilation errors on older versions of mingw.

Reported by Eli Zaretskii <eliz@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-06/msg00059.html>.

* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Test whether <bcrypt.h> exists.
* lib/getrandom.c: If <bcrypt.h> is not available, include <ntdef.h> and
define/declare BCRYPT_ALG_HANDLE, BCRYPT_USE_SYSTEM_PREFERRED_RNG,
BCryptGenRandom ourselves.

4 years agoautoupdate
Karl Berry [Sun, 28 Jun 2020 14:45:55 +0000 (07:45 -0700)]
autoupdate

4 years agoclean-temp: Fix wrong errno in error message.
Bruno Haible [Sun, 28 Jun 2020 10:26:55 +0000 (12:26 +0200)]
clean-temp: Fix wrong errno in error message.

* lib/clean-temp.c (create_temp_dir): Save errno around
unblock_fatal_signals call.

4 years agofatal-signal: Make multithread-safe.
Bruno Haible [Sat, 27 Jun 2020 22:40:04 +0000 (00:40 +0200)]
fatal-signal: Make multithread-safe.

* lib/fatal-signal.c (at_fatal_signal): Don't free the old actions array.

4 years agoclean-temp: Don't force deletion of temporary files on native Windows.
Bruno Haible [Sat, 27 Jun 2020 22:03:44 +0000 (00:03 +0200)]
clean-temp: Don't force deletion of temporary files on native Windows.

* lib/clean-temp.h (open_temp, fopen_temp): Add delete_on_close
argument.
* lib/clean-temp.c (open_temp, fopen_temp): Likewise.
* NEWS: Mention the change.
* lib/javacomp.c (write_temp_file): Update.

4 years agofatal-signal: Make multithread-safe.
Bruno Haible [Sat, 27 Jun 2020 21:17:38 +0000 (23:17 +0200)]
fatal-signal: Make multithread-safe.

* lib/fatal-signal.c: Include glthread/lock.h.
(at_fatal_signal_lock): New variable.
(at_fatal_signal): Use it.
(fatal_signals_block_lock, fatal_signals_block_counter): New variables.
(block_fatal_signals, unblock_fatal_signals): Use them.
* modules/fatal-signal (Depends-on): Add lock.

4 years agogetloadavg: don’t depend on fopen-gnu
Paul Eggert [Sat, 27 Jun 2020 16:44:11 +0000 (09:44 -0700)]
getloadavg: don’t depend on fopen-gnu

This is for Emacs, which does not need fopen-gnu for anything else,
and which would need it only on a NetBSD platform where getloadavg
does not work (does that even happen?).
* lib/getloadavg.c (getloadavg) [__NetBSD__]: Use open, not fopen.
* modules/getloadavg (Depends-on): Remove fopen-gnu.

4 years ago* tests/test-getloadavg.c (main): Fix typo.
Paul Eggert [Sat, 27 Jun 2020 16:40:29 +0000 (09:40 -0700)]
* tests/test-getloadavg.c (main): Fix typo.

4 years agoautoupdate
Karl Berry [Sat, 27 Jun 2020 16:04:19 +0000 (09:04 -0700)]
autoupdate

4 years agotempname et al.: Fix link errors on MSVC (regression from 2020-05-31).
Bruno Haible [Sat, 27 Jun 2020 09:47:59 +0000 (11:47 +0200)]
tempname et al.: Fix link errors on MSVC (regression from 2020-05-31).

* modules/tempname (Link): New section.
* modules/mkdtemp (Link): Likewise.
* modules/clean-temp (Link): Likewise.
* modules/mkstemp (Link): Likewise.
* modules/stdlib-safer (Link): Likewise.
* modules/mkstemps (Link): Likewise.
* modules/mkostemp (Link): Likewise.
* modules/mkostemps (Link): Likewise.
* modules/tmpfile (Link): Likewise.
* modules/tmpfile-safer (Link): Likewise.
* modules/javacomp (Link): Add $(LIB_GETRANDOM).
* modules/argv-iter-tests (Makefile.am): Link test-argv-iter with
$(LIB_GETRANDOM).
* NEWS: Mention the changes.

4 years agofopen-gnu: Simplify code.
Bruno Haible [Sat, 27 Jun 2020 09:08:51 +0000 (11:08 +0200)]
fopen-gnu: Simplify code.

* lib/fopen.c: Include <stdbool.h>.
(rpl_fopen): Use a single variable open_flags instead of
open_flags_standard and open_flags_gnu. Make open_flags_gnu a bool.
* modules/fopen (Depends-on): Add stdbool.

4 years agotmpfile: Fix a typo.
Bruno Haible [Sat, 27 Jun 2020 01:14:43 +0000 (03:14 +0200)]
tmpfile: Fix a typo.

* lib/tmpfile.c: Fix a typo.

4 years agocanonicalize: Improve documentation.
Bruno Haible [Sat, 27 Jun 2020 00:11:08 +0000 (02:11 +0200)]
canonicalize: Improve documentation.

* lib/canonicalize.h (canonicalize_filename_mode): Document the failure
return convention.

4 years agoxgetcwd: Improve documentation.
Bruno Haible [Sat, 27 Jun 2020 01:00:01 +0000 (03:00 +0200)]
xgetcwd: Improve documentation.

* lib/xgetcwd.c (xgetcwd): Document the failure return convention.

4 years agogetcwd: Improve documentation.
Bruno Haible [Sat, 27 Jun 2020 00:59:07 +0000 (02:59 +0200)]
getcwd: Improve documentation.

* lib/getcwd.c (__getcwd): Document the failure return convention.

4 years agofchdir: Improve documentation.
Bruno Haible [Sat, 27 Jun 2020 00:44:38 +0000 (02:44 +0200)]
fchdir: Improve documentation.

* lib/fchdir.c (get_name, _gl_register_fd): Document the failure return
convention.

4 years agofilenamecat-lgpl: Set errno upon failure.
Bruno Haible [Sat, 27 Jun 2020 00:39:08 +0000 (02:39 +0200)]
filenamecat-lgpl: Set errno upon failure.

* lib/filenamecat-lgpl.c (mfile_name_concat): Document the failure
return convention.
* modules/filenamecat-lgpl (Depends-on): Add malloc-posix.

4 years agoareadlink-with-size: Set errno upon failure.
Bruno Haible [Sat, 27 Jun 2020 00:06:54 +0000 (02:06 +0200)]
areadlink-with-size: Set errno upon failure.

* lib/areadlink-with-size.c (areadlink_with_size): Set errno when malloc
fails.
* lib/areadlinkat-with-size.c (areadlinkat_with_size): Add comment.

4 years agocopy-file: Shrink dependencies.
Bruno Haible [Fri, 26 Jun 2020 14:04:15 +0000 (16:04 +0200)]
copy-file: Shrink dependencies.

* modules/copy-file (Depends-on): Remove acl. Add acl-permissions,
qcopy-acl.

4 years agodoc: Mention declaration fixes implemented by some modules.
Bruno Haible [Fri, 26 Jun 2020 11:38:22 +0000 (13:38 +0200)]
doc: Mention declaration fixes implemented by some modules.

* doc/posix-functions/chdir.texi: Mention the module 'chdir'.
* doc/posix-functions/close.texi: Mention that Gnulib makes the function
declaration appear in <unistd.h>.
* doc/posix-functions/dup.texi: Likewise.
* doc/posix-functions/dup2.texi: Likewise.
* doc/posix-functions/gethostname.texi: Likewise.
* doc/posix-functions/isatty.texi: Likewise.
* doc/posix-functions/lseek.texi: Likewise.
* doc/posix-functions/unlink.texi: Likewise.
* doc/posix-functions/read.texi: Mention the module 'read'.
* doc/posix-functions/write.texi: Mention the effects of the module
'write'.

4 years agoc-dtoastr, c-ldtoastr: new modules
Marc Nieper-Wißkirchen [Wed, 20 May 2020 11:59:31 +0000 (13:59 +0200)]
c-dtoastr, c-ldtoastr: new modules

These modules provide the same functionality as the modules
dtoastr and ldtoastr except for the formatting taking place in the
C locale.

* MODULES.html.sh: Add c-dtoastr and c-ldtoastr.
* lib/c-dtoastr.c, lib/c-ldtoastr.c: New files.
* lib/ftoastr.c: Prefix exported functions when the macro C_LOCALE is
defined.  Use c_snprintf and c_strtod/c_strtold instead of
snprintf and strtod/strtold whhen the macro C_LOCALE is defined.
* lib/ftoastr.h: Add prototypes for c_dtoastr and c_ldtoastr.
* modules/c-dtoastr, modules/c-dtoastr-tests, modules/c-ldtoastr,
modules/c-ldtoastr-tests: New files.
* tests/test-c-dtoastr.c, tests/test-c-dtoastr.sh,
tests-c-ldtoastr.c tests-c-ldtoastr.sh: New files.

4 years agotzset: Fix compilation warnings on mingw (regression from 2017-05-01).
Bruno Haible [Sun, 21 Jun 2020 20:54:46 +0000 (22:54 +0200)]
tzset: Fix compilation warnings on mingw (regression from 2017-05-01).

* lib/tzset.c: Include <stdlib.h>, <string.h>.

4 years agoautoupdate
Karl Berry [Sun, 21 Jun 2020 15:10:10 +0000 (08:10 -0700)]
autoupdate