]> Savannah Git Hosting - gnulib.git/log
gnulib.git
2 years agofts: fail gracefully when out of memory
ChuanGang Jiang [Mon, 27 Feb 2023 11:46:12 +0000 (11:46 +0000)]
fts: fail gracefully when out of memory

* lib/fts.c (fts_read): Set errno==ENOMEM and return NULL
when setup_dir() fails, rather than hitting an assertion later.

2 years agodfa: Avoid warnings with some Apple clang versions.
Bruno Haible [Sun, 26 Feb 2023 15:56:19 +0000 (16:56 +0100)]
dfa: Avoid warnings with some Apple clang versions.

Reported by Werner Lemberg <wl@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00159.html>.

* lib/dfa.c (FALLTHROUGH): When __apple_build_version__ is defined,
ignore __clang_major__.
References:
https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2
https://github.com/apple/llvm-project/blob/swift-5.3-RELEASE/clang/test/Sema/fallthrough-attr.c

2 years agolseek: avoid SEEK_HOLE bugs in FreeBSD, macOS
Paul Eggert [Sun, 19 Feb 2023 06:05:24 +0000 (00:05 -0600)]
lseek: avoid SEEK_HOLE bugs in FreeBSD, macOS

This attempts to fix <https://bugs.gnu.org/61386>, a bug in GNU cp
caused by a serious data corruption bug in FreeBSD and macOS.
* doc/posix-functions/lseek.texi: Mention the bug.
* lib/unistd.in.h (SEEK_DATA, SEEK_HOLE): Undef in macOS < 13 and
FreeBSD < 14.  FreeBSD fixed the bug sometime during FreeBSD 13
<https://bugs.freebsd.org/256205>, so the "FreeBSD < 14" is
conservative.  It’s unknown when Apple will fix macOS so use
macOS "9999" as a placeholder.
* m4/lseek.m4 (gl_FUNC_LSEEK): Replace lseek if on one of the
above platforms.

2 years agohamt: Detect GCC version correctly.
ChuanGang Jiang [Mon, 13 Feb 2023 12:35:43 +0000 (13:35 +0100)]
hamt: Detect GCC version correctly.

* lib/hamt.h:Use __GNUC_MINOR__, not  __GNUC_MINOR.

2 years agoterminfo, termcap: Avoid wrong configure result with clang ≥ 15.
Bruno Haible [Sat, 11 Feb 2023 23:36:10 +0000 (00:36 +0100)]
terminfo, termcap: Avoid wrong configure result with clang ≥ 15.

clang 15 reports an error for -Wint-conversion by default.

Reported by Sam James <sam@gentoo.org> in
<https://savannah.gnu.org/bugs/?63793>.

* m4/terminfo.m4 (gl_TERMINFO_BODY): Avoid a -Wint-conversion warning
when testing for tparam and tparm.
* m4/termcap.m4 (gl_TERMCAP_BODY): Likewise.

2 years agounilbrk: Don't compile unused functions outside of libunistring.
Bruno Haible [Sat, 11 Feb 2023 19:10:21 +0000 (20:10 +0100)]
unilbrk: Don't compile unused functions outside of libunistring.

* lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks): Don't
compile outside of libunistring.
* lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks):
Likewise.
* lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks):
Likewise.
* lib/unilbrk/ulc-possible-linebreaks.c (ulc_possible_linebreaks):
Likewise.
* lib/unilbrk/u8-width-linebreaks.c (u8_width_linebreaks): Likewise.
* lib/unilbrk/u16-width-linebreaks.c (u16_width_linebreaks): Likewise.
* lib/unilbrk/u32-width-linebreaks.c (u32_width_linebreaks): Likewise.
* lib/unilbrk/ulc-width-linebreaks.c (ulc_width_linebreaks): Likewise.
* tests/unilbrk/test-u8-possible-linebreaks.c (main): Outside of
libunistring, don't test the backward compatibility function.
* tests/unilbrk/test-u16-possible-linebreaks.c (main): Likewise.
* tests/unilbrk/test-u32-possible-linebreaks.c (main): Likewise.
* tests/unilbrk/test-ulc-possible-linebreaks.c (main): Likewise.
* tests/unilbrk/test-u8-width-linebreaks.c (main): Likewise.
* tests/unilbrk/test-u16-width-linebreaks.c (main): Likewise.
* tests/unilbrk/test-u32-width-linebreaks.c (main): Likewise.
* tests/unilbrk/test-ulc-width-linebreaks.c (main): Likewise.

2 years agosigsegv: Fix a compilation error on OpenBSD with clang ≥ 16.
Bruno Haible [Sat, 11 Feb 2023 17:48:08 +0000 (18:48 +0100)]
sigsegv: Fix a compilation error on OpenBSD with clang ≥ 16.

* lib/sigsegv.c (install_for): Add a cast when assigning to
action.sa_sigaction.

2 years agomkfifoat: Fix crash on macOS 12.
Bruno Haible [Thu, 2 Mar 2023 19:52:16 +0000 (20:52 +0100)]
mkfifoat: Fix crash on macOS 12.

* m4/gnulib-common.m4 (gl_PREPARE_CHECK_FUNCS_MACOS,
gl_CHECK_FUNCS_MACOS): New macros.
* m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Test for mknodat and mkfifoat using
gl_CHECK_FUNCS_MACOS instead of AC_CHECK_FUNCS_ONCE.

2 years agochown, lchown, fchownat tests: Avoid test failure on macOS 12.
Bruno Haible [Fri, 10 Feb 2023 12:46:22 +0000 (13:46 +0100)]
chown, lchown, fchownat tests: Avoid test failure on macOS 12.

* tests/test-chown.h (test_chown): Skip some assertions if
getgid() == (gid_t)-1.
* tests/test-lchown.h (test_lchown): Likewise.

2 years agomath: Fix compilation error in C++ mode on macOS 12.5.
Bruno Haible [Thu, 9 Feb 2023 18:27:37 +0000 (19:27 +0100)]
math: Fix compilation error in C++ mode on macOS 12.5.

* lib/math.in.h (isnan): On macOS, treat clang version 14 again like
clang versions < 12.

2 years agoFix compilation errors in C++ mode on macOS 12.5.
Bruno Haible [Thu, 9 Feb 2023 17:37:55 +0000 (18:37 +0100)]
Fix compilation errors in C++ mode on macOS 12.5.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Don't define
_GL_ATTRIBUTE_MAYBE_UNUSED to [[__maybe_unused__]] if the compiler is
an Apple variant of clang.

2 years agolimits-h: Work around a clang 15 bug.
Bruno Haible [Thu, 9 Feb 2023 12:30:04 +0000 (13:30 +0100)]
limits-h: Work around a clang 15 bug.

* m4/limits-h.m4 (gl_LIMITS_H): Test also for BOOL_MAX.
* lib/limits.in.h: Handle the case where BOOL_WIDTH is present and
BOOL_MAX is missing.
* doc/posix-headers/limits.texi: Mention the clang bug.

2 years agoFix error in C++ mode on glibc systems (regression 2022-04-28).
Bruno Haible [Thu, 9 Feb 2023 12:16:31 +0000 (13:16 +0100)]
Fix error in C++ mode on glibc systems (regression 2022-04-28).

* lib/string.in.h (rpl_free): Add exception specification like
stdlib.in.h does.
* lib/wchar.in.h (rpl_free): Likewise.

2 years agogetcwd: Fix compilation error in C23 mode.
Bruno Haible [Thu, 9 Feb 2023 11:53:22 +0000 (12:53 +0100)]
getcwd: Fix compilation error in C23 mode.

* lib/getcwd.c: Include <stdio.h>.

2 years agoassert-h: Fix test failure on IRIX 6.5.
Bruno Haible [Wed, 8 Feb 2023 21:31:57 +0000 (22:31 +0100)]
assert-h: Fix test failure on IRIX 6.5.

* m4/assert_h.m4 (gl_ASSERT_H): Ensure that on IRIX, including
<assert.h> after <config.h> actually defines the assert macro.

2 years agoFix a copyright header - module license mismatch.
Bruno Haible [Tue, 7 Feb 2023 12:36:23 +0000 (13:36 +0100)]
Fix a copyright header - module license mismatch.

Reported by Bjarni Ingi Gislason <bjarniig@simnet.is> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00057.html>.

* lib/gen-uni-tables.c (output_predicate): For uniwidth/width2.h, use an
LGPLv2+ license.
(output_nonspacing_property): Use an LGPLv2+ license.
* lib/uniwidth/width0.h: Regenerated.
* lib/uniwidth/width2.h: Likewise.

2 years agosetlocale-null: Don't use a lock in Cygwin >= 3.4.6.
Bruno Haible [Mon, 6 Feb 2023 17:33:37 +0000 (18:33 +0100)]
setlocale-null: Don't use a lock in Cygwin >= 3.4.6.

Road paved by Corinna Vinschen <vinschen@redhat.com>.

* m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Assume that
setlocale (LC_ALL, NULL) is multithread-safe in Cygwin >= 3.4.6.
* lib/setlocale_null.c: Update comments.
* tests/test-setlocale_null-mt-all.c: Likewise.

2 years agoUpdate build-aux/po/Makefile.in.in.
Bruno Haible [Sun, 5 Feb 2023 16:20:50 +0000 (17:20 +0100)]
Update build-aux/po/Makefile.in.in.

Reported by Reuben Thomas <rrt@sc3d.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00020.html>.

* build-aux/po/Makefile.in.in: Sync from GNU gettext 0.21.1.
Fixes:
- In the .po -> .gmo rules, consider the newest changes to the POT file.
- Emit a warning when creating a tarball without POT file.

2 years agoassert-h, verify: Fix compilation error in C++ mode with MSVC 14.
Bruno Haible [Sun, 5 Feb 2023 10:19:28 +0000 (11:19 +0100)]
assert-h, verify: Fix compilation error in C++ mode with MSVC 14.

* lib/verify.h (static_assert): Define _ALLOW_KEYWORD_MACROS.
* tests/test-assert-h-c++.cc: Strengthen test.
* tests/test-assert-h-c++2.cc: Likewise.

2 years agoassert-h, verify: Fix conflict with standard C++ header files on macOS.
Bruno Haible [Sat, 4 Feb 2023 13:31:08 +0000 (14:31 +0100)]
assert-h, verify: Fix conflict with standard C++ header files on macOS.

* lib/verify.h (_Static_assert): Don't redefine with clang ≥ 3.8.0
in C++ mode.
* tests/test-assert-h-c++.cc: Also check against conflict with the
standard C++ header files.
* tests/test-assert-h-c++2.cc: Likewise.

2 years agorelocatable-prog: Fix compiler warning.
Bruno Haible [Sat, 4 Feb 2023 01:51:04 +0000 (02:51 +0100)]
relocatable-prog: Fix compiler warning.

* lib/progreloc.c (full_read): Use a non-const pointer.

2 years agoat-internal: Fix support for z/OS.
Bruno Haible [Mon, 30 Jan 2023 22:10:21 +0000 (23:10 +0100)]
at-internal: Fix support for z/OS.

* lib/openat-proc.c (openat_proc_name) [z/OS]: Proper error handling.
Convert only the relevant part of the dir[] buffer.

2 years agoat-internal: Add support for z/OS.
Bruno Haible [Mon, 30 Jan 2023 11:30:21 +0000 (12:30 +0100)]
at-internal: Add support for z/OS.

Reported and draft patch by Igor Todorovski <itodorov@ca.ibm.com>.

* lib/openat-proc.c [z/OS]: Include <termios.h>.
(openat_proc_name): For z/OS, use an approach similar to kLIBC, with
3 lines of z/OS specific code by Igor Todorovski <itodorov@ca.ibm.com>.

2 years agomaintainer-makefile: Determine gnulib's location on disk correctly.
Bruno Haible [Mon, 30 Jan 2023 01:45:23 +0000 (02:45 +0100)]
maintainer-makefile: Determine gnulib's location on disk correctly.

* top/maint.mk (gnulib_dir): Give priority to $(GNULIB_SRCDIR) over
$(srcdir)/gnulib.

2 years agoFix compilation errors with CC="clang -D_FORTIFY_SOURCE=2" on Android.
Bruno Haible [Sun, 29 Jan 2023 22:51:42 +0000 (23:51 +0100)]
Fix compilation errors with CC="clang -D_FORTIFY_SOURCE=2" on Android.

Reported by Alexey Rochev <equeim@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnu-libiconv/2023-01/msg00019.html>.

* lib/cdefs.h (__bos, __bos0, __glibc_objsize0, __glibc_objsize,
__glibc_safe_len_cond, __glibc_unsigned_or_positive,
__glibc_safe_or_unknown_len, __glibc_unsafe_len, __glibc_fortify,
__glibc_fortify_n): Don't define these macros in Gnulib.
* lib/libc-config.h: Don't undefine these macros in Gnulib.

2 years agoClarify _GL_ATTRIBUTE_NODISCARD code.
Bruno Haible [Sat, 28 Jan 2023 19:22:02 +0000 (20:22 +0100)]
Clarify _GL_ATTRIBUTE_NODISCARD code.

Reported by Paul Eggert.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Add comment regarding
_GL_ATTRIBUTE_NODISCARD definition.

2 years agounistdio/*printf: Fix negative width handling for %U, %lU, %llU.
Bruno Haible [Sat, 28 Jan 2023 18:39:23 +0000 (19:39 +0100)]
unistdio/*printf: Fix negative width handling for %U, %lU, %llU.

* lib/vasnprintf.c (VASNPRINTF): In the code for %U, %lU, %llU, test for
the FLAG_LEFT bit in the flags variable.

2 years agovasnprintf-posix: Fix possible bug with negative width handling for %lc.
Bruno Haible [Sat, 28 Jan 2023 18:05:24 +0000 (19:05 +0100)]
vasnprintf-posix: Fix possible bug with negative width handling for %lc.

* lib/vasnprintf.c (VASNPRINTF): In the code for %lc in vasnprintf, test
for the FLAG_LEFT bit in the flags variable.

2 years agovasnprintf-posix: Fix negative width handling for %ls directive.
Bruno Haible [Sat, 28 Jan 2023 17:17:17 +0000 (18:17 +0100)]
vasnprintf-posix: Fix negative width handling for %ls directive.

Reported by clang via Po Lu <luangruo@yahoo.com>.

* lib/vasnprintf.c (VASNPRINTF): In the code for %ls in vasnprintf and
for %s in vasnwprintf, test for the FLAG_LEFT bit in the flags variable.

2 years agoAvoid clang warnings regarding [[__nodiscard__]].
Bruno Haible [Sat, 28 Jan 2023 10:52:40 +0000 (11:52 +0100)]
Avoid clang warnings regarding [[__nodiscard__]].

* m4/gnulib-common.m4 (gl_COMMON_BODY): For clang, in C++ mode, ignore
the __has_c_attribute value and define _GL_ATTRIBUTE_NODISCARD to
__attribute__ ((__warn_unused_result__)), not [[__nodiscard__]].

2 years agoAvoid clang warnings regarding [[__maybe_unused__]].
Bruno Haible [Sat, 28 Jan 2023 08:33:12 +0000 (09:33 +0100)]
Avoid clang warnings regarding [[__maybe_unused__]].

* m4/gnulib-common.m4 (gl_COMMON_BODY): For clang versions ≥ 6, < 10,
in C++ mode, ignore the __has_c_attribute value and define
_GL_ATTRIBUTE_MAYBE_UNUSED to __attribute__ ((__unused__)), not
[[__maybe_unused__]].

2 years agostddef: Fix test-stddef compilation error on FreeBSD 12/x86.
Bruno Haible [Fri, 27 Jan 2023 19:35:59 +0000 (20:35 +0100)]
stddef: Fix test-stddef compilation error on FreeBSD 12/x86.

* m4/stddef_h.m4 (gl_STDDEF_H): When testing for good max_align_t, use
an ISO C compliant definition of _Alignof.

2 years agoKeep config.h idempotent.
Bruno Haible [Wed, 25 Jan 2023 13:36:20 +0000 (14:36 +0100)]
Keep config.h idempotent.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Add double-inclusion guards to
the definitions of the macros _GL_ATTRIBUTE_ALLOC_SIZE,
_GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL,
_GL_ATTRIBUTE_COLD, _GL_ATTRIBUTE_CONST, _GL_ATTRIBUTE_DEALLOC,
_GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR, _GL_ATTRIBUTE_WARNING,
_GL_ATTRIBUTE_EXTERNALLY_VISIBLE, _GL_ATTRIBUTE_FALLTHROUGH,
_GL_ATTRIBUTE_FORMAT, _GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MALLOC,
_GL_ATTRIBUTE_MAY_ALIAS, _GL_ATTRIBUTE_MAYBE_UNUSED,
_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE, _GL_ATTRIBUTE_NONNULL,
_GL_ATTRIBUTE_NONSTRING, _GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED,
_GL_ATTRIBUTE_PURE, _GL_ATTRIBUTE_RETURNS_NONNULL,
_GL_ATTRIBUTE_SENTINEL, _GL_ATTRIBUTE_UNUSED, _GL_UNUSED_LABEL.

2 years agovasnprintf: Fix compilation error on Android NDK r26b.
Bruno Haible [Wed, 25 Jan 2023 08:53:21 +0000 (09:53 +0100)]
vasnprintf: Fix compilation error on Android NDK r26b.

Reported by Po Lu <luangruo@yahoo.com>.

* lib/vasnprintf.c: Include <wchar.h>.

2 years agothreadlib: Fix support for Solaris 9 and older.
Nick Bowler [Wed, 25 Jan 2023 08:38:00 +0000 (09:38 +0100)]
threadlib: Fix support for Solaris 9 and older.

* m4/threadlib.m4 (gl_PTHREADLIB_BODY): Allow case patterns to survive
m4 processing by using changequote.

2 years agoautoupdate
Karl Berry [Sun, 22 Jan 2023 16:29:03 +0000 (08:29 -0800)]
autoupdate

2 years agostdalign: Fix a compilation error on FreeBSD 12.0.
Bruno Haible [Tue, 24 Jan 2023 12:36:11 +0000 (13:36 +0100)]
stdalign: Fix a compilation error on FreeBSD 12.0.

* lib/stdalign.in.h (_Alignof): In C mode, prefer __builtin_offsetof
over offsetof when possible, since __builtin_offsetof works also when
<stddef.h> has not been fully included yet.
* m4/stdalign.m4 (gl_STDALIGN_H): Likewise.

2 years agosigsegv, vma-iter: port to Solaris 10
Paul Eggert [Sun, 22 Jan 2023 06:49:04 +0000 (00:49 -0600)]
sigsegv, vma-iter: port to Solaris 10

On this platform, <sys/types.h> does not define off_t if neither
_LP64 nor _FILE_OFFSET_BITS is defined, which can happen if we
of doing stdbool, since config.h now includes <stdbool.h>, and
Solaris 10 <stdbool.h> includes <sys/feature_tests.h> which
arranges for _FILE_OFFSET_BITS to always be defined (if only to 32),
which <sys/types.h> assumes.
* lib/stackvma.c, lib/vma-iter.c (_FILE_OFFSET_BITS) [__sun && !_LP64]:
Define to 32 instead of leaving undefined.

2 years agosnippet/_Noreturn: work around Clang _Noreturn bug
Paul Eggert [Fri, 20 Jan 2023 03:39:03 +0000 (19:39 -0800)]
snippet/_Noreturn: work around Clang _Noreturn bug

This is a bigger-hammer workaround for the clang _Noreturn issue
fix for dfa.c on 2023-01-01.  Unfortunately, it causes 270
-Wreturn-type and -Wsometimes-uninitialized warnings when building
bleeding-edge GNU Emacs from Git on Fedora 37 with plain
‘./configure && make’.  So the workaround is enabled only if you
compile with -D_GL_WORK_AROUND_LLVM_BUG_59792.
* lib/_Noreturn.h (_Noreturn):
* m4/gnulib-common.m4 (gl_COMMON_BODY):
and if _GL_WORK_AROUND_LLVM_BUG_59792 is defined.

2 years agoexecute tests: Avoid test failure with GNU make 4.4.
Bruno Haible [Tue, 17 Jan 2023 21:13:36 +0000 (22:13 +0100)]
execute tests: Avoid test failure with GNU make 4.4.

Reported by Eric Blake in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00157.html>.

* tests/test-execute-main.c (main): Reset the SIGPIPE handler to
default on all platforms.

2 years agofflush: Tweak last commit.
Bruno Haible [Tue, 17 Jan 2023 19:17:27 +0000 (20:17 +0100)]
fflush: Tweak last commit.

* lib/stdio-impl.h (fp_): Make the last change work also with newer
Android NDKs and _FILE_OFFSET_BITS=64.

2 years agofflush: Fix a buffer overrun on 32-bit Android.
Bruno Haible [Tue, 17 Jan 2023 18:16:29 +0000 (19:16 +0100)]
fflush: Fix a buffer overrun on 32-bit Android.

* lib/stdio-impl.h (fp_): On Android, change the type of _offset to
'long'.
* lib/fflush.c (update_fpos_cache): On Android, update a 'long', not an
'fpos_t'.

2 years agoexecute tests: Avoid test failure on Android.
Bruno Haible [Tue, 17 Jan 2023 14:15:57 +0000 (15:15 +0100)]
execute tests: Avoid test failure on Android.

* tests/test-execute-main.c (main): Reset the SIGPIPE handler to
default.

2 years agoautoupdate
Karl Berry [Mon, 16 Jan 2023 16:54:54 +0000 (08:54 -0800)]
autoupdate

2 years agofpending: Fix compilation error with NDK ≥ r14b and Android API < 23.
Bruno Haible [Sun, 15 Jan 2023 10:10:09 +0000 (11:10 +0100)]
fpending: Fix compilation error with NDK ≥ r14b and Android API < 23.

Report and patch by Po Lu <luangruo@yahoo.com>.

* lib/fpending.c (__fpending) [__ANDROID__]: Use the fp_ macro.

2 years agotest-framework-sh: work around AIX 7.2 diff bugs
Paul Eggert [Sun, 15 Jan 2023 00:47:41 +0000 (16:47 -0800)]
test-framework-sh: work around AIX 7.2 diff bugs

* tests/init.sh (compare_dev_null_): Run diff in the C locale.
AIX 7.2 diff messes up in UTF-8 locales; for example,
‘printf '\360\220\200\200\n' | diff - /dev/null’ incorrectly
outputs nothing and exits with status 0 when LC_ALL=en_US.UTF-8.

2 years agoverify: work around xlclang 16.1 compiler bug
Paul Eggert [Fri, 13 Jan 2023 22:32:11 +0000 (14:32 -0800)]
verify: work around xlclang 16.1 compiler bug

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/grep-devel/2023-01/msg00003.html
* lib/verify.h (_GL_HAS_BUILTIN_TRAP, _GL_HAS_BUILTIN_UNREACHABLE):
Define to 0 if compiler advertises itself as clang before version 5.
xlclang 16.1 advertises itself as 4.0.1 and this patch works
around what appears to be a compiler bug when compiling dfa.c in
bleeding-edge grep.

2 years agoassert-h: fix configure comment-out
Paul Eggert [Fri, 13 Jan 2023 19:57:35 +0000 (11:57 -0800)]
assert-h: fix configure comment-out

* m4/assert_h.m4 (gl_ASSERT_H): Also break apart "#undef
static_assert" with /**/.  Problem discovered with xlclang 16.1,
though it does not directly affect xlclang 16.1.

2 years agoFix link errors on Android 4.3.
Bruno Haible [Wed, 11 Jan 2023 09:50:41 +0000 (10:50 +0100)]
Fix link errors on Android 4.3.

* lib/asyncsafe-spin.c: Don't use the GCC >= 4.1 builtins on Android,
when building with GCC.
* lib/pthread-spin.c: Likewise.
* lib/simple-atomic.c: Likewise.

2 years agomemset_explicit tests: Fix signature check.
Bruno Haible [Tue, 10 Jan 2023 11:19:42 +0000 (12:19 +0100)]
memset_explicit tests: Fix signature check.

* tests/test-memset_explicit.c: Fix return type in signature check.

2 years agothreads-h: Improve portability.
Bruno Haible [Mon, 9 Jan 2023 20:31:52 +0000 (21:31 +0100)]
threads-h: Improve portability.

* lib/threads.in.h: Use INCLUDE_NEXT_AS_FIRST_DIRECTIVE when possible.
* modules/threads-h (Makefile.am): Substitute
INCLUDE_NEXT_AS_FIRST_DIRECTIVE and NEXT_AS_FIRST_DIRECTIVE_THREADS_H.

2 years agomalloc-h: Improve portability.
Bruno Haible [Mon, 9 Jan 2023 20:18:20 +0000 (21:18 +0100)]
malloc-h: Improve portability.

* lib/malloc.in.h: Use INCLUDE_NEXT_AS_FIRST_DIRECTIVE when possible.
* modules/malloc-h (Makefile.am): Substitute
INCLUDE_NEXT_AS_FIRST_DIRECTIVE and NEXT_AS_FIRST_DIRECTIVE_MALLOC_H.

2 years agoautoupdate
Karl Berry [Sat, 7 Jan 2023 16:25:56 +0000 (08:25 -0800)]
autoupdate

2 years agocopy-file, supersede: Fix link-time requirements.
Bruno Haible [Thu, 5 Jan 2023 10:26:04 +0000 (11:26 +0100)]
copy-file, supersede: Fix link-time requirements.

* modules/copy-file (Link): Add $(LIB_ACL).
* modules/supersede (Link): Likewise.

2 years agoautoupdate
Karl Berry [Wed, 4 Jan 2023 16:36:46 +0000 (08:36 -0800)]
autoupdate

2 years agosigsegv: Fix compilation error on Android 4.3.
Bruno Haible [Mon, 2 Jan 2023 15:57:31 +0000 (16:57 +0100)]
sigsegv: Fix compilation error on Android 4.3.

* lib/sigsegv.in.h: For Android, don't include <ucontext.h> and don't
reference ucontext_t.
* lib/sigsegv.c (SIGSEGV_FAULT_): For Android, use a plain POSIX fault
handler (cf. libsigsegv/src/fault-posix.h).

2 years agodfa: work around Clang 15 bug
Paul Eggert [Mon, 2 Jan 2023 06:06:10 +0000 (22:06 -0800)]
dfa: work around Clang 15 bug

Problem reported by Kenton Groombridge in:
https://lists.gnu.org/archive/html/bug-gawk/2022-12/msg00010.html
On x86-64, Clang 15 gets confused by a call (X ? dfaerror :
dfawarn) (Y) and generates the wrong code, presumably because
dfaerror is _Noreturn and dfawarn is not.
* lib/dfa.c (parse_bracket_exp): Reword to have one call for
dfaerror, the other for dfawarn.

2 years agomaint: run 'make update-copyright'
Simon Josefsson [Sun, 1 Jan 2023 00:14:21 +0000 (01:14 +0100)]
maint: run 'make update-copyright'

2 years agoassert-h: port static_assert to strict C99
Paul Eggert [Wed, 28 Dec 2022 22:15:43 +0000 (14:15 -0800)]
assert-h: port static_assert to strict C99

* lib/verify.h (_GL_VERIFY): Port MSVC hack back to C99.
Problem found when testing bleeding-edge gzip on IBM XL C for AIX,
V12.1 (5765-J02, 5725-C72), which complained ‘"malloca.c", line
42.56: 1506-041 (E) The invocation of macro _Static_assert
contains fewer arguments than are required by the macro
definition.’  This diagnostic is valid because C99 requires
that if you #define _Static_assert(R, ...) you must call
_Static_assert with at least two arguments.  I found a similar
problem with Sun C 5.9 SunOS_sparc Patch 124867-12 2009/11/22.

2 years agofile-has-acl: fix recently-introduced NFSv4 bug
Paul Eggert [Wed, 28 Dec 2022 04:00:58 +0000 (20:00 -0800)]
file-has-acl: fix recently-introduced NFSv4 bug

* lib/file-has-acl.c (acl_nfs4_nontrivial): Fix off-by-one
error when rounding WHOLEN up to next multiple of 4.
Pacify GCC 12.2.1 -Wcast-align.

2 years agofdatasync: fix comment
Paul Eggert [Tue, 27 Dec 2022 19:49:59 +0000 (11:49 -0800)]
fdatasync: fix comment

2 years agoAdd --pull, --gen options to build-aux/bootstrap
Paul Eggert [Tue, 27 Dec 2022 16:15:38 +0000 (08:15 -0800)]
Add --pull, --gen options to build-aux/bootstrap

This supports a single bootstrap script with --pull and --gen
options, as an alternative to separate autogen.sh and autopull.sh
and bootstrap-funclib.sh auxiliary files.
* top/bootstrap: With --version, also output library version.
Support update of package that has only the bootstrap script,
and not the other three files.

2 years agoSupport packages with just 'bootstrap'
Paul Eggert [Tue, 27 Dec 2022 16:15:38 +0000 (08:15 -0800)]
Support packages with just 'bootstrap'

* top/bootstrap: With --version, also output library version.
Support update of package that has only the bootstrap script,
and not the other three files.
* top/bootstrap-funclib.sh (scriptlibversion): Rename
from scriptversion.  All uses changed.  This way we
can distinguish script from script library versions.
(upgrade_bootstrap): If the package currently has only
the bootstrap script, just update that.

2 years agoBootstrap with functions, not scripts
Paul Eggert [Tue, 27 Dec 2022 16:15:37 +0000 (08:15 -0800)]
Bootstrap with functions, not scripts

* top/bootstrap: Use autopull and autogen functions, not
shell scripts.  This lets build-aux/bootstrap become a
standalone script.  It does not change the behavior of
top/bootstrap, except for minor rewording of disagnostics.

2 years agoMake autopull a shell function too
Paul Eggert [Tue, 27 Dec 2022 16:15:37 +0000 (08:15 -0800)]
Make autopull a shell function too

This does not change behavior.  It is helpful for future changes.
* top/autopull.sh: Call autopull to do the actual work.
(usage, download_po_files, update_po_files):
Move to top/bootstrap-funclib.sh.
* top/bootstrap-funclib.sh (autopull_usage): Rename from ‘usage’.
(autopull): New function, containing the top level of the
old top/autopull.sh.

2 years agoMake autogen a shell function too
Paul Eggert [Tue, 27 Dec 2022 16:15:37 +0000 (08:15 -0800)]
Make autogen a shell function too

This does not change behavior.  It is helpful for future changes.
* top/autogen.sh: Call autogen to do the actual work.
(usage, version_controlled_file, gitignore_entries, insert_if_absent):
(insert_vc_ignore, symlink_to_dir): Move to top/bootstrap-funclib.sh.
* top/bootstrap-funclib.sh (autogen_usage): Rename from ‘usage’.
(autogen): New function, containing the top level of the
old top/autogen.sh.

2 years agoMove scriptversion= lines up in scripts
Paul Eggert [Tue, 27 Dec 2022 16:15:37 +0000 (08:15 -0800)]
Move scriptversion= lines up in scripts

By default they need to be in the first 8 lines to be updated.

2 years agoFix compilation errors in C++ mode on Solaris 11 OpenIndiana.
Bruno Haible [Tue, 27 Dec 2022 10:21:45 +0000 (11:21 +0100)]
Fix compilation errors in C++ mode on Solaris 11 OpenIndiana.

* m4/gnulib-common.m4 (gl_COMMON_BODY): In _GL_ATTRIBUTE_DEALLOC_FREE,
with GNU C++, cast the 'free' function.
* lib/string.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): With GNU C++, cast the
'free' function.
* lib/wchar.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): Likewise.

2 years agostdnoreturn: Mark as deprecated, not obsolete. (Regression 2022-12-24.)
Bruno Haible [Tue, 27 Dec 2022 10:13:05 +0000 (11:13 +0100)]
stdnoreturn: Mark as deprecated, not obsolete. (Regression 2022-12-24.)

* modules/stdnoreturn (Status): Remove.
(Notice): Say that it is deprecated, not obsolete.
* doc/noreturn.texi: Fix a typo.

2 years agostdbool-c99: fix typo
Paul Eggert [Mon, 26 Dec 2022 18:17:17 +0000 (10:17 -0800)]
stdbool-c99: fix typo

Reported against Autoconf by Todd C. Miller in:
https://lists.gnu.org/r/autoconf/2022-12/msg00001.html
* m4/stdbool.m4 (AC_CHECK_HEADER_STDBOOL): Sync from Autoconf master.

2 years agoctime: Mark as deprecated, not obsolete. (Regression 2022-12-21.)
Bruno Haible [Mon, 26 Dec 2022 17:12:45 +0000 (18:12 +0100)]
ctime: Mark as deprecated, not obsolete. (Regression 2022-12-21.)

* modules/ctime (Status): Remove.
(Notice): Say that it is deprecated, not obsolete.

2 years agolargefile: sync from Autoconf master
Paul Eggert [Sun, 25 Dec 2022 19:41:57 +0000 (11:41 -0800)]
largefile: sync from Autoconf master

* m4/largefile.m4 (gl_SET_LARGEFILE_SOURCE): Test whether
AC_SYS_YEAR2038 is defined when this macro is defined, not when it
is used, as we now define AC_SYS_YEAR2038 later.
(_AC_SYS_LARGEFILE_MACRO_VALUE): Remove.
(_AC_SYS_YEAR2038_TEST_CODE, _AC_SYS_YEAR2038_OPTIONS)
(_AC_SYS_YEAR2038_PROBE, _AC_SYS_YEAR2038_ENABLE)
(_AC_SYS_YEAR2038_OPT_IN, AC_SYS_YEAR2038)
(_AC_SYS_LARGEFILE_TEST_CODE, _AC_SYS_LARGEFILE_OPTIONS)
(_AC_SYS_LARGEFILE_PROBE, _AC_SYS_LARGEFILE_ENABLE): New macros.
(AC_SYS_LARGEFILE): Use them.
* m4/year2038.m4: Remove.  All mentions removed.
* modules/largefile, modules/year2038 (configure.ac-early):
Do not require gl_YEAR2038_EARLY.
* modules/year2038 (Depends-on): Depend on largefile.
(configure.ac): Require AC_SYS_YEAR2038, not gl_YEAR2038.

2 years agoextensions: enable some C23 Annex F functions
Paul Eggert [Sun, 25 Dec 2022 07:39:41 +0000 (23:39 -0800)]
extensions: enable some C23 Annex F functions

* m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS):
Also define __STDC_WANT_IEC_60559_EXT__, for C23 Annex F
functions like totalorder.  This syncs from Autoconf master.

2 years agostdnoreturn: deprecate
Paul Eggert [Sat, 24 Dec 2022 09:29:29 +0000 (01:29 -0800)]
stdnoreturn: deprecate

C23 says <stdnoreturn.h> is obsolescent, so deprecate the
stdnoreturn module.  I don't think it was being used anyway
as it had too many problems.
* modules/stdnoreturn: Mark as obsolete.

2 years agodoc: C2x → C23
Paul Eggert [Sat, 24 Dec 2022 08:10:23 +0000 (00:10 -0800)]
doc: C2x → C23

2 years agofile-has-acl: improve recent NFSv4 support
Paul Eggert [Fri, 23 Dec 2022 23:18:29 +0000 (15:18 -0800)]
file-has-acl: improve recent NFSv4 support

This fixes a link failure with emacsclient on GNU/Linux.  This
program wants file_has_acl but none of the other ACL primitives,
so it doesn’t link acl-internal.o; this way it doesn’t need to
link with -lacl.  While I was at it I reviewed the recent changes,
fixed some unlikely overflow bugs, and adjusted to GNU style.
* doc/acl-nfsv4.txt: Remove.  Its contents are now in a
comment in lib/file-has-acl.c.
* lib/acl-internal.c, lib/acl-internal.h: Move recent changes
relating to acl_nfs4_nontrivial to lib/file-has-acl.c, so that
there is no trouble linking programs that need only file_has_acl.
* lib/file-has-acl.c (acl_nfs4_nontrivial): Move here from
lib/acl-internal.c, so that we needn't link -lacl in
programs that want only file_has_acl, such as emacsclient.
Do not assume a char buffer is aligned for uint32_t.
Check more carefully for buffer read overrun.
Allow up to 6 ACEs, since other code does; but check
that they’re distinct.  Avoid integer overflow.
Use memcmp rather than strncmp to compare memory blocks.
(file_has_acl): Preserve initial errno instead of setting to 0.
Allocate a bit more room for trivial ACL buffer.
Use EINVAL for botchedk NFSv4 ACLs (which shouldn’t happen).

2 years agoposix_spawnp-tests: fix filename typo
Paul Eggert [Fri, 23 Dec 2022 05:19:34 +0000 (21:19 -0800)]
posix_spawnp-tests: fix filename typo

Problem reported for GNU m4 by Mitchell Dorrell in:
https://lists.gnu.org/r/bug-m4/2022-12/msg00000.html
* tests/test-posix_spawnp-script.c (DATA_FILENAME):
Fix typo in file name that caused race with
test-posix_spawn-script.c.

2 years agofile-has-acl: Basic support for checking NFSv4 ACLs in Linux.
Ondrej Valousek [Fri, 2 Dec 2022 12:40:19 +0000 (13:40 +0100)]
file-has-acl: Basic support for checking NFSv4 ACLs in Linux.

* lib/acl-internal.h (acl_nfs4_nontrivial): New declaration.
* lib/acl-internal.c (acl_nfs4_nontrivial): New function.
* lib/file-has-acl.c: Include <arpa/inet.h>.
(XATTR_NAME_NFSV4_ACL, TRIVIAL_NFS4_ACL_MAX_LENGTH): New macros.
(file_has_acl): Test for NFSv4 ACLs.
* doc/acl-nfsv4.txt: New file.

2 years agoPort __has_c_attribute to strict C23
Paul Eggert [Thu, 22 Dec 2022 05:45:18 +0000 (21:45 -0800)]
Port __has_c_attribute to strict C23

* m4/gnulib-common.m4 (_GL_HAS_C_ATTRIBUTE): Remove, as C23 says
behavior is undefined if __has_c_attribute appears anywhere other
than at the top level of an #if or #ifdef.  All uses replaced by
wordier invocations of __has_c_attribute.

2 years agoasctime, ctime: deprecate
Paul Eggert [Wed, 21 Dec 2022 21:25:39 +0000 (13:25 -0800)]
asctime, ctime: deprecate

C23 deprecates asctime and ctime, so deprecate them in Gnulib too.
* NEWS, doc/posix-functions/asctime.texi:
* doc/posix-functions/ctime.texi: Mention this.
* lib/time.in.h (ctime): Deprecate any ctime replacement.
* modules/ctime: Now obsolete.

2 years agoautoupdate
Karl Berry [Tue, 20 Dec 2022 21:03:38 +0000 (13:03 -0800)]
autoupdate

2 years agomemset_explicit: port to older MS-Windows
Paul Eggert [Sun, 18 Dec 2022 07:45:56 +0000 (23:45 -0800)]
memset_explicit: port to older MS-Windows

* lib/memset_explicit.c (memset_explicit):
Remove special case for C==0 and MS-Windows.  The code isn’t
needed for correctness and it’s more trouble than it’s worth as it
prevents this module from being used with GNU Emacs, which wants
to port to MS-Windows versions so old that they lack
SecureZeroMemory.

2 years agoUpdate users.txt.
Bruno Haible [Fri, 9 Dec 2022 23:58:37 +0000 (00:58 +0100)]
Update users.txt.

* users.txt: Add lbzip2.

2 years agofts: make debug version compilable again
Paul Eggert [Fri, 9 Dec 2022 23:31:33 +0000 (15:31 -0800)]
fts: make debug version compilable again

This fixes things in what I hope is a better way than the
fd-only approach proposed by Kamil Dudka here:
https://lists.gnu.org/archive/html/bug-gnulib/2018-03/msg00079.html
https://lists.gnu.org/archive/html/bug-gnulib/2018-03/msg00080.html
* lib/fts.c (GNULIB_FTS_DEBUG): Rename from FTS_DEBUG,
to avoid collision with coreutils symbol.
Do not include <stdint.h> (not needed, since we include <stdint.h>)
or "getcwdat.h" (no longer exists).
(fd_ring_check, fd_ring_print): Add forward decls.
(struct devino): New type.
(PRINT_DEVINO): New macro.
(getdevino): New static function.
(fd_ring_print): Do nothing if not debugging.
(fd_ring_print, fd_ring_check): Use getdevino instead of getcwdat.
The output isn’t as good, but at least it compiles and runs.

2 years agoverify: update __STDC_VERSION__ as per C23
Paul Eggert [Thu, 8 Dec 2022 00:34:26 +0000 (16:34 -0800)]
verify: update __STDC_VERSION__ as per C23

This shouldn’t affect anything; it’s merely a refactoring.
* lib/verify.h (_GL_HAVE__STATIC_ASSERT1): Require
__STDC_VERSION__ to be at least 202311, instead of at least
202000.  The latter number was put in in 2019 because we didn’t
yet know C23’s __STDC_VERSION__ value.

2 years agofts: fix race + mishandling of fstatat failure
Paul Eggert [Tue, 6 Dec 2022 18:27:43 +0000 (10:27 -0800)]
fts: fix race + mishandling of fstatat failure

I hope this fixes a Luke Dashjr coreutils bug report about ext4
ramdisks; see “9.1: du Aborted (corrupt filesystem)”
<https://debbugs.gnu.org/59821>.
* lib/fts.c (fts_build): Fix two bugs.  First, fts_stat was being
called without checking its return value, causing a later abort.
Second, there was a race between opening a directory and statting
it, fixed by using fstat on the file descriptor rather than
fstatat on the directory name.

2 years agofts: omit goto break_without_closedir
Paul Eggert [Tue, 6 Dec 2022 18:03:56 +0000 (10:03 -0800)]
fts: omit goto break_without_closedir

* lib/fts.c (fts_build): Refactor to omit goto.

2 years agofts: clarify ISSET
Paul Eggert [Tue, 6 Dec 2022 17:56:55 +0000 (09:56 -0800)]
fts: clarify ISSET

* lib/fts.c (ISSET): Refactor to clarify boolean usage.

2 years agoargp: Correct documentation.
Bruno Haible [Mon, 5 Dec 2022 23:25:34 +0000 (00:25 +0100)]
argp: Correct documentation.

Reported by José E. Marchesi <jemarch@gnu.org>.

* doc/glibc-functions/argp_*.texi: Mention the 'argp' module.

2 years agodoc: poll: document poll of special files not supported on macOS
Pádraig Brady [Fri, 2 Dec 2022 14:45:23 +0000 (14:45 +0000)]
doc: poll: document poll of special files not supported on macOS

* doc/posix-functions/poll.texi: Reinstate (updated) macOS info,
removed in recent cleanup re removal of support for Mac OS X <= 10.4.
* m4/poll.m4: Update macOS to latest tested version.

2 years agoadd new ronna and quetta SI prefixes
Pádraig Brady [Tue, 29 Nov 2022 15:05:07 +0000 (15:05 +0000)]
add new ronna and quetta SI prefixes

As voted for in Nov 2022 by the BIPM:
https://www.bipm.org/en/cgpm-2022/resolution-3

* lib/human.c: Add Ronna (10^27), and Quetta (10^30) to the prefix list.
* lib/xstrtol.c (__xstrtol): Likewise.

2 years agoUpdate users.txt.
Bruno Haible [Tue, 29 Nov 2022 12:31:13 +0000 (13:31 +0100)]
Update users.txt.

* users.txt: Add 4ti2, ale, amanda, binfmt-support, cgminer, collectd,
complexity, dc3dd, dico, enchant-2, fuse-overlayfs, gsequencer, idutils,
libu2f-host, licenseutils, mmv, pacemaker, trader, ttfautohint.

2 years agoexplicit_bzero: implement via memset_explicit
Paul Eggert [Mon, 28 Nov 2022 04:52:05 +0000 (20:52 -0800)]
explicit_bzero: implement via memset_explicit

* lib/explicit_bzero.c (explicit_bzero):
Simplify by just calling memset_explicit.
* m4/explicit_bzero.m4 (gl_PREREQ_EXPLICIT_BZERO): Remove.
All uses removed.
* modules/explicit_bzero (Depends-on): Add memset_explicit.

2 years agoexplicit_bzero: memset_explicit is standard
Paul Eggert [Mon, 28 Nov 2022 04:52:04 +0000 (20:52 -0800)]
explicit_bzero: memset_explicit is standard

* doc/glibc-functions/explicit_bzero.texi:
Say that memset_explicit is preferred in new code.

2 years agoread-file: use memset_explicit
Paul Eggert [Mon, 28 Nov 2022 04:52:04 +0000 (20:52 -0800)]
read-file: use memset_explicit

* lib/read-file.c (fread_file, read_file):
Use memset_explicit instead of explicit_bzero.
* modules/read-file (Depends-on): Depend on memset_explicit
instead of on explicit_bzero.

2 years agomemset_explicit: new module
Paul Eggert [Mon, 28 Nov 2022 04:52:04 +0000 (20:52 -0800)]
memset_explicit: new module

* doc/posix-functions/memset_explicit.texi, lib/memset_explicit.c:
* m4/memset_explicit.m4, modules/memset_explicit:
* modules/memset_explicit-tests, tests/test-memset_explicit.c:
New files.
* lib/string.in.h (memset_explict): New decl.
* m4/string_h.m4 (gl_STRING_H, gl_STRING_H_REQUIRE_DEFAULTS)
(gl_STRING_H_DEFAULTS):
* modules/string (string.h):
Support memset_explicit.

2 years agoexplicit_bzero: add poison
Paul Eggert [Mon, 28 Nov 2022 01:15:24 +0000 (17:15 -0800)]
explicit_bzero: add poison

* m4/string_h.m4 (gl_STRING_H): Poison explicit_bzero.
This was inadvertently omitted when explicit_bzero was added.

2 years agobootstrap: Fix --help output.
Arsen Arsenović [Sun, 27 Nov 2022 19:45:06 +0000 (20:45 +0100)]
bootstrap: Fix --help output.

* build-aux/bootstrap (usage): Regenerate.

2 years agoexplicit_bzero: work with gcc -std=c99
Paul Eggert [Sun, 27 Nov 2022 17:59:32 +0000 (09:59 -0800)]
explicit_bzero: work with gcc -std=c99

* lib/explicit_bzero.c (explicit_bzero) [__GNUC__ && !__clang__]:
Use __asm__ instead of asm.

2 years agoPrefer "kill -INT" to killing with a number
Paul Eggert [Sat, 26 Nov 2022 18:43:24 +0000 (10:43 -0800)]
Prefer "kill -INT" to killing with a number

* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK):
* tests/test-login_tty.c (main):
* tests/test-pthread_sigmask1.c (main):
* tests/test-sigprocmask.c (main):
Prefer "kill -INT" to "kill -N" where N is SIGINT’s value.
Don’t assume pid_t fits in int.