Bruno Haible [Fri, 17 Mar 2023 11:25:37 +0000 (12:25 +0100)]
vasnwprintf: New module.
* lib/vasnprintf.c: Enable more code for WIDE_CHAR_VERSION, because
snwprintf()/_snwprintf() (Windows) and swprintf() (Unix) don't return
the needed buffer size, like snprintf does.
* lib/wprintf-parse.h: New file, based on lib/printf-parse.h and
gettext/gettext-runtime/intl/wprintf-parse.h.
* lib/wprintf-parse.c: New file, based on
gettext/gettext-runtime/intl/printf.c.
* lib/vasnwprintf.h: New file, based on lib/vasnprintf.h and
gettext/gettext-runtime/intl/vasnwprintf.h.
* lib/vasnwprintf.c: New file.
* lib/asnwprintf.c: New file, based on lib/asnprintf.c.
* m4/vasnprintf.m4 (gl_FUNC_VASNWPRINTF): New macro.
(gl_PREREQ_VASNXPRINTF): New macro, extracted from gl_PREREQ_VASNPRINTF.
(gl_PREREQ_VASNPRINTF): Invoke it. Don't test for wcsnlen and mbrtowc.
(gl_PREREQ_VASNWPRINTF): New macro.
* modules/vasnwprintf: New file, based on modules/vasnprintf.
Bruno Haible [Thu, 16 Mar 2023 12:45:40 +0000 (13:45 +0100)]
stddef: Define 'unreachable', for ISO C 23 compliance.
* lib/verify.h (_GL_HAS_BUILTIN_UNREACHABLE): Don't define if already
defined.
* lib/stddef.in.h (_GL_HAS_BUILTIN_UNREACHABLE, unreachable): New
macros.
(abort): Declare if needed for unreachable.
* m4/stddef_h.m4 (gl_STDDEF_H): Test for unreachable.
* tests/test-stddef.c (test_unreachable_optimization,
test_unreachable_noreturn): New functions, based on tests/test-verify.c.
* doc/posix-headers/stddef.texi: Mention unreachable.
Jim Meyering [Thu, 9 Mar 2023 17:58:35 +0000 (09:58 -0800)]
bootstrap: correct last change
* top/bootstrap-funclib.sh (autogen) [AUTORECONFFLAGS]: Do always
apply the --no-recursive option.
* build-aux/bootstrap: Regenerate.
Spotted by Bruno Haible.
Jim Meyering [Thu, 9 Mar 2023 16:41:07 +0000 (08:41 -0800)]
bootstrap: remove code that accommodated RHEL5's old autoreconf
* top/bootstrap-funclib.sh (autogen) [AUTORECONFFLAGS]: RHEL5 has not
been supported since 2017. It included (and this code worked around)
a version of autoreconf that was so old it did not accept the
--no-recursive option. Drop that workaround.
* build-aux/bootstrap: Regenerate.
Bruno Haible [Wed, 8 Mar 2023 16:00:48 +0000 (17:00 +0100)]
time: New module.
* lib/time.in.h (time): New declaration.
* lib/time.c: New file.
* m4/time_h.m4 (gl_TIME_H_REQUIRE_DEFAULTS): Initialize GNULIB_TIME.
(gl_TIME_H_DEFAULTS): Initialize REPLACE_TIME.
* m4/time.m4: New file.
* modules/time-h (Makefile.am): Substitute GNULIB_TIME, REPLACE_TIME.
* modules/time: New file.
* tests/test-time-h-c++.cc: Check the signature of
GNULIB_NAMESPACE::time.
* doc/posix-functions/time.texi: Mention the glibc problem and the
'time' module.
Bruno Haible [Wed, 8 Mar 2023 09:14:00 +0000 (10:14 +0100)]
gettimeofday tests: Enhance test.
* tests/test-gettimeofday.c: Include <stdlib.h> and macros.h.
(test_clobber): New function, extracted from main.
(test_consistency): New function, based on tests/test-timespec_get.c.
(main): Invoke both functions.
* modules/gettimeofday-tests (Files): Add macros.h.
Paul Eggert [Mon, 6 Mar 2023 00:25:49 +0000 (16:25 -0800)]
stdio: suppress macOS 13 sprintf warnings
* lib/stdio.in.h (_POSIX_C_SOURCE, _GL_DEFINED__POSIX_C_SOURCE):
Suppress deprecation warnings for sprintf and vsprintf
that were introduced in macOS 13. These are not useful
for Gnulib itself, and are more likely than not to be
merely an annoyance for Gnulib-using code.
Bruno Haible [Tue, 28 Feb 2023 04:46:19 +0000 (05:46 +0100)]
perl: Allow this module to be used with 'gnulib-tool --lgpl'.
Reported by Reuben Thomas <rrt@sc3d.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00191.html>.
* modules/perl (License): Relax to 'GPLed build tool'.
Approved by Jim Meyering in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00198.html>.
Bruno Haible [Tue, 28 Feb 2023 04:59:25 +0000 (05:59 +0100)]
dfa: Tweak the last patch.
Suggested by Alexei Podtelezhnikov <apodtele@gmail.com>.
* lib/dfa.c (FALLTHROUGH): Assume that Apple clang, in C mode, supports
__attribute__ ((__fallthrough__)) starting with version 1200.
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
Jim Meyering [Sat, 25 Feb 2023 21:20:43 +0000 (13:20 -0800)]
announce-gen: add more info the auto-generated announce template
* build-aux/announce-gen (readable_interval, readable_interval0):
New functions.
(digest_file_base64_wrap): New function to add padding to the
base64-encoded SHA256 checksums.
(print_checksums): Use that wrapper. Indent each line by two spaces.
(main): Emit new sections, e.g., these lines from grep-3.8's release:
- There have been 104 commits by 6 people in the 55 weeks since 3.7.
- The following people contributed changes to this release: (and list)
I tested with this, running from a sibling cloned grep directory:
../gnulib/build-aux/announce-gen --release-type=stable \
--package-name=grep --previous-version=3.7 --current-version=3.8 \
--gpg-key-id=0x7FD9FCCB000BEEEE --url-directory=https://testing
Also, reference the cksum programs from coreutils-9.2 and from OpenBSD.
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.
Bruno Haible [Sat, 18 Feb 2023 15:59:22 +0000 (16:59 +0100)]
configmake: Add support for $build_os != $host_os.
* m4/build-to-host.m4: New file.
* m4/configmake.m4 (gl_CONFIGMAKE_PREP): Provide a configure-time
definition for pkgdatadir, pkgincludedir, pkglibdir.
(gl_CONFIGMAKE): New macro.
* modules/configmake (Files): Add m4/build-to-host.m4.
(configure.ac): Invoke gl_CONFIGMAKE instead of gl_CONFIGMAKE_PREP.
(Makefile.am): For creating configmake.h, use the various *prefix_c_make
and *dir_c_make variables.
Bruno Haible [Sat, 11 Feb 2023 20:12:00 +0000 (21:12 +0100)]
error-h: Make less fragile.
* lib/error.in.h: Use #include_next if the system has an <error.h>. Use
a split double-inclusion guard.
* m4/error_h.m4 (gl_ERROR_H): Invoke gl_CHECK_NEXT_HEADERS. Set
HAVE_ERROR_H.
* modules/error-h (Makefile.am): Substitute GUARD_PREFIX, HAVE_ERROR_H,
INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, NEXT_ERROR_H.
Bruno Haible [Fri, 10 Feb 2023 19:15:08 +0000 (20:15 +0100)]
mkfifoat: Fix crash on macOS 12.
* m4/gnulib-common.m4 (gl_PREPARE_CHECK_FUNCS_MACOS,
gl_CHECK_FUNCS_MACOS, gl_CHECK_FUNCS_ANDROID_MACOS): New macros.
* m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Test for mknodat and mkfifoat using
gl_CHECK_FUNCS_ANDROID_MACOS instead of gl_CHECK_FUNCS_ANDROID.
Paul Eggert [Fri, 10 Feb 2023 01:09:23 +0000 (17:09 -0800)]
nullptr: work around Apple clang 14 issue
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2023-02/msg00098.html
* doc/gnulib.texi (nullptr): Document limitations better.
* m4/nullptr.m4 (gl_NULLPTR): Check for incompatibility of macOS
clang 14.0.0 (clang-1400.0.29.202), where <stddef.h> defines a
non-working nullptr macro.
Bruno Haible [Thu, 9 Feb 2023 15:08:00 +0000 (16:08 +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.
Bruno Haible [Wed, 8 Feb 2023 22:43:03 +0000 (23:43 +0100)]
nl_langinfo tests: Add another test.
* tests/test-nl_langinfo2.c: New file.
* tests/test-nl_langinfo2.sh: New file.
* modules/nl_langinfo-tests (Files): Add them. Add
intl-thread-locale.m4.
(Depends-on): Add c-strcasestr, stdbool.
(configure.ac): Invoke gt_FUNC_USELOCALE.
(Makefile.am): Arrange to compile test-nl_langinfo2 and test it through
test-nl_langinfo2.sh.
Paul Eggert [Wed, 8 Feb 2023 04:37:09 +0000 (20:37 -0800)]
nullptr: test for compilers at autoconf-time
* m4/nullptr.m4 (gl_NULLPTR): Test for C and C++ compiler usage at
autoconf-time. This should work better than testing at
configure-time. Also, push and pop languages so we check the
proper compiler.
Paul Eggert [Tue, 7 Feb 2023 23:11:32 +0000 (15:11 -0800)]
nullptr: test for C++ nullptr at configure-time
* m4/nullptr.m4 (gl_NULLPTR): Test for C++ support for nullptr
at configure-time, as we already do for C support.
This should be more reliable than maintaining #ifdefs by hand.
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.
Bruno Haible [Mon, 6 Feb 2023 03:15:15 +0000 (04:15 +0100)]
c-nullptr: Fix conflict with libstdc++ in GCC >= 11.
Reported by Bjarni Ingi Gislason <bjarniig@simnet.is> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00030.html>.
* m4/c-nullptr.m4 (gl_C_NULLPTR): Don't define nullptr if it is already
defined. In C++ mode, ignore the result of the configure test and don't
define it when we know that the C++ compiler already supports it.
Paul Eggert [Sun, 5 Feb 2023 21:20:54 +0000 (13:20 -0800)]
sh-quote: backport fix from diffutils
* lib/sh-quote.c (init_sh_quoting_options):
Use C89 through C17 style for parameterless static function.
This avoided a warning when compiling diffutils.
This patch is backported from a circa-2009 diffutils patch
and lets us remove diffutils/gl/lib/sh-quote.c.diff; see:
https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=8c3d25a63a2c5912170ef6e13f748f3904e6b5cf
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.
Paul Eggert [Sat, 4 Feb 2023 18:07:11 +0000 (10:07 -0800)]
fts: pacify GCC 13 -Wuse-after-free
Problem reported by Peter Frazier in:
https://lists.gnu.org/r/bug-gnulib/2023-02/msg00000.html
* lib/fts.c: Include stdint.h.
(fts_build): Do not access freed pointer directly; instead,
save its bit-pattern into a uintptr_t, and use that to compare.
(ADJUST): Likewise, but more trickily since this hack
puns pointer types and relies on undefined behavior.
* modules/fts (Depends-on): Add stdint.
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.
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>.
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.
* tests/unistdio/test-u8-printf1.h (test_xfunction): Add tests for width
given as argument for the directives %U, %lU, %llU, %s, %a, %f, %e, %g.
* tests/unistdio/test-u16-printf1.h (test_xfunction): Likewise.
* tests/unistdio/test-u32-printf1.h (test_xfunction): Likewise.
* tests/unistdio/test-ulc-printf1.h (test_xfunction): Likewise.
Bruno Haible [Sat, 28 Jan 2023 18:12:42 +0000 (19:12 +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.
* tests/test-vasnprintf-posix.c (test_function): Add tests for width
given as argument for the directives %c, %lc.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-snprintf-posix.c: Include <wchar.h>, for wint_t.
* tests/test-sprintf-posix.c: Likewise.
* tests/test-vsnprintf-posix.c: Likewise.
* tests/test-vsprintf-posix.c: Likewise.
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.
* tests/test-vasnprintf-posix.c (test_function): Add tests for width
given as argument for the directives %c, %lc.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
* tests/test-snprintf-posix.c: Include <wchar.h>, for wint_t.
* tests/test-sprintf-posix.c: Likewise.
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.
* tests/test-vasnprintf-posix.c (test_function): Add tests for width
given as argument for the directives %s, %ls.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.
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__]].
* 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__]].