]> Savannah Git Hosting - gnulib.git/log
gnulib.git
2 years agotime: Add tests.
Bruno Haible [Wed, 8 Mar 2023 16:02:38 +0000 (17:02 +0100)]
time: Add tests.

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

2 years agotime: New module.
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.

2 years agotime-h: Renamed from time.
Bruno Haible [Wed, 8 Mar 2023 09:41:00 +0000 (10:41 +0100)]
time-h: Renamed from time.

* modules/time-h: Renamed from modules/time.
* tests/test-time-h.c: Renamed from tests/test-time.c.
* modules/time-h-tests: Renamed from modules/time-tests. Update.
* tests/test-time-h-c++.cc: Renamed from tests/test-time-c++.cc.
* tests/test-time-h-c++2.cc: Renamed from tests/test-time-c++2.cc.
* modules/time-h-c++-tests: Renamed from modules/time-c++-tests. Update.
* modules/cond (Depends-on): Update.
* modules/ctime (Depends-on): Likewise.
* modules/localtime (Depends-on): Likewise.
* modules/mktime (Depends-on): Likewise.
* modules/nanosleep (Depends-on): Likewise.
* modules/parse-datetime (Depends-on): Likewise.
* modules/posixcheck (Depends-on): Likewise.
* modules/pthread-h (Depends-on): Likewise.
* modules/stat-time (Depends-on): Likewise.
* modules/stat-time-tests (Depends-on): Likewise.
* modules/strftime-fixes (Depends-on): Likewise.
* modules/strptime (Depends-on): Likewise.
* modules/sys_stat (Depends-on): Likewise.
* modules/tempname (Depends-on): Likewise.
* modules/threads-h (Depends-on): Likewise.
* modules/time_r (Depends-on): Likewise.
* modules/time_rz (Depends-on): Likewise.
* modules/timegm (Depends-on): Likewise.
* modules/timespec (Depends-on): Likewise.
* modules/timespec_get (Depends-on): Likewise.
* modules/timespec_getres (Depends-on): Likewise.
* modules/tzset (Depends-on): Likewise.
* modules/usleep-tests (Depends-on): Likewise.
* modules/utime (Depends-on): Likewise.
* modules/utimecmp (Depends-on): Likewise.
* modules/utimens (Depends-on): Likewise.
* modules/windows-cond (Depends-on): Likewise.
* modules/windows-timedmutex (Depends-on): Likewise.
* modules/windows-timedrecmutex (Depends-on): Likewise.
* modules/windows-timedrwlock (Depends-on): Likewise.
* modules/xnanosleep (Depends-on): Likewise.
* doc/posix-headers/time.texi: Update.
* NEWS: Mention the change.

2 years agogettimeofday tests: Enhance test.
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.

2 years agostdio: suppress macOS 13 sprintf warnings
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.

2 years agotimespec_get tests: Add comment.
Bruno Haible [Sun, 5 Mar 2023 19:42:12 +0000 (20:42 +0100)]
timespec_get tests: Add comment.

* tests/test-timespec_get.c: Add a comment regarding a glibc bug.

2 years agoRemove unused documentation file.
Bruno Haible [Sun, 5 Mar 2023 18:37:14 +0000 (19:37 +0100)]
Remove unused documentation file.

* doc/glibc-functions/timespec_getres.texi: Remove file.

2 years agoautoupdate
Karl Berry [Sun, 5 Mar 2023 15:49:59 +0000 (07:49 -0800)]
autoupdate

2 years agonl_langinfo tests: Avoid test failure on Solaris 11.
Bruno Haible [Thu, 2 Mar 2023 08:17:33 +0000 (09:17 +0100)]
nl_langinfo tests: Avoid test failure on Solaris 11.

* tests/test-nl_langinfo2.c (main): Skip French T_FMT_AMPM test on
Solaris.

2 years agoterminfo, termcap: Fix more spellos in a comment.
Benno Schulenberg [Mon, 27 Feb 2023 16:10:41 +0000 (17:10 +0100)]
terminfo, termcap: Fix more spellos in a comment.

* lib/tparm.c: Fix misspellings and wording in the main comment.

2 years agoperl: Allow this module to be used with 'gnulib-tool --lgpl'.
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>.

2 years agodfa: Tweak the last patch.
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

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 agoannounce-gen: spell OpenBSD with a capital "O"
Jim Meyering [Sun, 26 Feb 2023 17:17:28 +0000 (09:17 -0800)]
announce-gen: spell OpenBSD with a capital "O"

* build-aux/announce-gen (print_checksums): Capitalize
the "O" in OpenBSD, as suggested by Bruno Haible.

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__.

2 years agoannounce-gen: add more info the auto-generated announce template
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.

2 years agoterminfo, termcap: Fix typos in comments.
ChuanGang Jiang [Sat, 25 Feb 2023 13:56:49 +0000 (14:56 +0100)]
terminfo, termcap: Fix typos in comments.

* lib/tparm.c: Fix misspellings in comments.

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 agoconfigmake: Add support for $build_os != $host_os.
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.

2 years agoconfigmake: Prepare for using directory names with backslashes.
Bruno Haible [Sat, 18 Feb 2023 12:28:48 +0000 (13:28 +0100)]
configmake: Prepare for using directory names with backslashes.

* modules/configmake (Makefile.am): Use printf instead of echo.

2 years agounilbrk tests: Fix compilation failures (regression 2023-02-11).
Bruno Haible [Sat, 18 Feb 2023 11:08:33 +0000 (12:08 +0100)]
unilbrk tests: Fix compilation failures (regression 2023-02-11).

* 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 agoImprove 'git diff' of *.m4 files.
Bruno Haible [Fri, 17 Feb 2023 22:17:34 +0000 (23:17 +0100)]
Improve 'git diff' of *.m4 files.

* .gitattributes: Add rule for *.m4 files.

2 years agoImprove cross-compilation for midipix.
Bruno Haible [Fri, 17 Feb 2023 21:58:36 +0000 (22:58 +0100)]
Improve cross-compilation for midipix.

Reported by Ørjan Malde <red@foxi.me> at
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00131.html>.

This patch handles the cases where midipix acts like Linux.

* m4/chmod.m4 (gl_FUNC_CHMOD): Treat midipix like Linux with glibc or
musl libc.
* m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Likewise.
* m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise.
* m4/link.m4 (gl_FUNC_LINK): Likewise.
* m4/linkat.m4 (gl_FUNC_LINKAT): Likewise.
* m4/lstat.m4 (gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): Likewise.
* m4/mkdir.m4 (gl_FUNC_MKDIR): Likewise.
* m4/pselect.m4 (gl_FUNC_PSELECT): Likewise.
* m4/ptsname.m4 (gl_FUNC_PTSNAME): Likewise.
* m4/readlink.m4 (gl_FUNC_READLINK): Likewise.
* m4/rename.m4 (gl_FUNC_RENAME): Likewise.
* m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise.
* m4/select.m4 (gl_FUNC_SELECT): Likewise.
* m4/sleep.m4 (gl_FUNC_SLEEP): Likewise.
* m4/stat.m4 (gl_FUNC_STAT): Likewise.
* m4/symlink.m4 (gl_FUNC_SYMLINK): Likewise.
* m4/symlinkat.m4 (gl_FUNC_SYMLINKAT): Likewise.
* m4/unlink.m4 (gl_FUNC_UNLINK): Likewise.
* m4/usleep.m4 (gl_FUNC_USLEEP): Likewise.

2 years agoImprove cross-compilation from midipix.
Bruno Haible [Fri, 17 Feb 2023 15:24:34 +0000 (16:24 +0100)]
Improve cross-compilation from midipix.

Reported by Ørjan Malde <red@foxi.me> at
<https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00131.html>.

Since midipix consists of musl libc based on an emulation of Linux system
calls, for pure libc functionality it can be treated like musl libc.

* m4/calloc.m4 (_AC_FUNC_CALLOC_IF): Treat midipix like systems with
musl libc.
* m4/cbrtl.m4 (gl_FUNC_CBRTL): Likewise.
* m4/ceil.m4 (gl_FUNC_CEIL): Likewise.
* m4/ceilf.m4 (gl_FUNC_CEILF): Likewise.
* m4/ceill.m4 (gl_FUNC_CEILL): Likewise.
* m4/exp2l.m4 (gl_FUNC_EXP2L): Likewise.
* m4/expl.m4 (gl_FUNC_EXPL): Likewise.
* m4/expm1.m4 (gl_FUNC_EXPM1): Likewise.
* m4/expm1f.m4 (gl_FUNC_EXPM1F): Likewise.
* m4/expm1l.m4 (gl_FUNC_EXPM1L): Likewise.
* m4/fclose.m4 (gl_FUNC_FCLOSE_STDIN): Likewise.
* m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): Likewise.
* m4/ffsll.m4 (gl_FUNC_FFSLL): Likewise.
* m4/floor.m4 (gl_FUNC_FLOOR): Likewise.
* m4/floorf.m4 (gl_FUNC_FLOORF): Likewise.
* m4/fmod.m4 (gl_FUNC_FMOD): Likewise.
* m4/fmodf.m4 (gl_FUNC_FMODF): Likewise.
* m4/fmodl.m4 (gl_FUNC_FMODL): Likewise.
* m4/fnmatch.m4 (gl_FUNC_FNMATCH_POSIX): Likewise.
* m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Likewise.
* m4/fpurge.m4 (gl_FUNC_FPURGE): Likewise.
* m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise.
* m4/getline.m4 (gl_FUNC_GETLINE): Likewise.
* m4/hypot.m4 (gl_FUNC_HYPOT): Likewise.
* m4/hypotf.m4 (gl_FUNC_HYPOTF): Likewise.
* m4/hypotl.m4 (gl_FUNC_HYPOTL): Likewise.
* m4/iconv_open-utf.m4 (gl_FUNC_ICONV_OPEN_UTF_SUPPORT): Likewise.
* m4/log.m4 (gl_FUNC_LOG): Likewise.
* m4/log10.m4 (gl_FUNC_LOG10): Likewise.
* m4/log10f.m4 (gl_FUNC_LOG10F): Likewise.
* m4/log10l.m4 (gl_FUNC_LOG10L_WORKS): Likewise.
* m4/log1p.m4 (gl_FUNC_LOG1P): Likewise.
* m4/log1pf.m4 (gl_FUNC_LOG1PF): Likewise.
* m4/log1pl.m4 (gl_FUNC_LOG1PL, gl_FUNC_LOG1PL_WORKS): Likewise.
* m4/log2.m4 (gl_FUNC_LOG2): Likewise.
* m4/log2f.m4 (gl_FUNC_LOG2F): Likewise.
* m4/log2l.m4 (gl_FUNC_LOG2L_WORKS): Likewise.
* m4/logf.m4 (gl_FUNC_LOGF): Likewise.
* m4/logl.m4 (gl_FUNC_LOGL_WORKS): Likewise.
* m4/malloc.m4 (_AC_FUNC_MALLOC_IF): Likewise.
* m4/mkstemp.m4 (gl_FUNC_MKSTEMP): Likewise.
* m4/modf.m4 (gl_FUNC_MODF): Likewise.
* m4/modff.m4 (gl_FUNC_MODFF): Likewise.
* m4/modfl.m4 (gl_FUNC_MODFL): Likewise.
* m4/musl.m4 (gl_MUSL_LIBC): Likewise.
* m4/perror.m4 (gl_FUNC_PERROR): Likewise.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_SECURE,
gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE,
gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2,
gl_FUNC_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN): Likewise.
* m4/printf.m4 (gl_PRINTF_SIZES_C99, gl_PRINTF_INFINITE,
gl_PRINTF_INFINITE_LONG_DOUBLE, gl_PRINTF_DIRECTIVE_A,
gl_PRINTF_DIRECTIVE_F, gl_PRINTF_FLAG_ZERO, gl_SNPRINTF_TRUNCATION_C99,
gl_SNPRINTF_RETVAL_C99, gl_SNPRINTF_DIRECTIVE_N,
gl_VSNPRINTF_ZEROSIZE_C99): Likewise.
* m4/pthread_rwlock_rdlock.m4 (gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER):
Likewise.
* m4/putenv.m4 (gl_FUNC_PUTENV): Likewise.
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Likewise.
* m4/remainder.m4 (gl_FUNC_REMAINDER): Likewise.
* m4/remainderf.m4 (gl_FUNC_REMAINDERF): Likewise.
* m4/remainderl.m4 (gl_FUNC_REMAINDERL, gl_FUNC_REMAINDERL_WORKS):
Likewise.
* m4/rintl.m4 (gl_FUNC_RINTL): Likewise.
* m4/round.m4 (gl_FUNC_ROUND): Likewise.
* m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.
* m4/roundl.m4 (gl_FUNC_ROUNDL): Likewise.
* m4/setenv.m4 (gl_FUNC_SETENV): Likewise.
* m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Likewise.
* m4/signbit.m4 (gl_SIGNBIT): Likewise.
* m4/stpncpy.m4 (gl_FUNC_STPNCPY): Likewise.
* m4/strerror.m4 (gl_FUNC_STRERROR, gl_FUNC_STRERROR_0): Likewise.
* m4/strtod.m4 (gl_FUNC_STRTOD): Likewise.
* m4/strtold.m4 (gl_FUNC_STRTOLD): Likewise.
* m4/trunc.m4 (gl_FUNC_TRUNC): Likewise.
* m4/truncf.m4 (gl_FUNC_TRUNCF): Likewise.
* m4/truncl.m4 (gl_FUNC_TRUNCL): Likewise.
* m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): Likewise.
* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Likewise.

2 years agoFix an old ChangeLog entry.
Bruno Haible [Wed, 15 Feb 2023 21:21:27 +0000 (22:21 +0100)]
Fix an old ChangeLog entry.

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 agoerror-h: Make less fragile.
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.

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.

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 agoFix code duplication in last commit.
Bruno Haible [Fri, 10 Feb 2023 20:32:11 +0000 (21:32 +0100)]
Fix code duplication in last commit.

* m4/gnulib-common.m4 (gl_CHECK_FUNCS_DEFAULT_CASE,
gl_CHECK_FUNCS_CASE_FOR_ANDROID, gl_CHECK_FUNCS_CASE_FOR_MACOS,
gl_CHECK_FUNCS_SET_RESULTS): New macros, extracted from
gl_CHECK_FUNCS_ANDROID, gl_CHECK_FUNCS_MACOS,
gl_CHECK_FUNCS_ANDROID_MACOS.
(gl_CHECK_FUNCS_ANDROID, gl_CHECK_FUNCS_MACOS,
gl_CHECK_FUNCS_ANDROID_MACOS): Use them.

2 years agomkfifoat: Fix crash on macOS 12.
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.

2 years agoFix typos like "the the" and "a a" in comments.
ChuanGang Jiang [Fri, 10 Feb 2023 14:34:25 +0000 (14:34 +0000)]
Fix typos like "the the" and "a a" in comments.

* lib/c32is-impl.h: s/the the/the/
* lib/getopt-pfx-core.h: s/a a/a/
* lib/term-style-control.h: s/the the/the/
* lib/textstyle.in.h: Likewise.

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 agonullptr: work around Apple clang 14 issue
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.

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 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.

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.
* 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/malloc.in.h (rpl_free): Add exception specification like
stdlib.in.h does.
* lib/string.in.h (rpl_free): Likewise.
* 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 agox-to-1: Accept additional help2man arguments.
Bruno Haible [Thu, 9 Feb 2023 04:10:39 +0000 (05:10 +0100)]
x-to-1: Accept additional help2man arguments.

* build-aux/x-to-1.in: Fix last commit: Don't collapse adjacent whitespace
characters in the help2man options.

2 years agox-to-1: Accept additional help2man arguments.
Bruno Haible [Thu, 9 Feb 2023 02:42:39 +0000 (03:42 +0100)]
x-to-1: Accept additional help2man arguments.

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

* build-aux/x-to-1.in: Allow additional options after the HELP2MAN
argument, and pass them down to help2man.

2 years agox-to-1: Document the configure-time prerequisites.
Bruno Haible [Wed, 8 Feb 2023 23:30:52 +0000 (00:30 +0100)]
x-to-1: Document the configure-time prerequisites.

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

* build-aux/x-to-1.in: Add more comments.

2 years agohard-locale: Add comment regarding per-thread locales.
Bruno Haible [Wed, 8 Feb 2023 22:45:41 +0000 (23:45 +0100)]
hard-locale: Add comment regarding per-thread locales.

* lib/hard-locale.h (hard_locale): Add comment.

2 years agonl_langinfo: Add comment regarding per-thread locales.
Bruno Haible [Wed, 8 Feb 2023 22:44:33 +0000 (23:44 +0100)]
nl_langinfo: Add comment regarding per-thread locales.

* lib/nl_langinfo.c (ctype_codeset): Add comment.

2 years agonl_langinfo tests: Add another test.
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.

2 years agonl_langinfo tests: Prepare for adding more tests.
Bruno Haible [Wed, 8 Feb 2023 22:38:08 +0000 (23:38 +0100)]
nl_langinfo tests: Prepare for adding more tests.

* tests/test-nl_langinfo1.c: Renamed from tests/test-nl_langinfo.c.
* tests/test-nl_langinfo1.sh: Renamed from tests/test-nl_langinfo.sh.
Update.
* modules/nl_langinfo-tests (Files, Makefile.am): Update.

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 agonullptr: test for compilers at autoconf-time
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.

2 years agonullptr: test for C++ nullptr at configure-time
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.

2 years agonullptr: rename from c-nullptr
Paul Eggert [Tue, 7 Feb 2023 22:30:54 +0000 (14:30 -0800)]
nullptr: rename from c-nullptr

* NEWS, doc/gnulib.texi: Mention this.
* m4/nullptr.m4: Rename from m4/c-nullptr.m4.
(gl_NULLPTR): Rename from gl_C_NULLPTR.
* modules/nullptr: Rename from modules/nullptr.
* modules/nullptr-c++-tests: Rename from modules/c-nullptr-c++-tests.
* modules/nullptr-tests: Rename from modules/c-nullptr-tests.
All uses changed.

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 agocheck-copyright: Don't fail because of the 'glob' module.
Bruno Haible [Tue, 7 Feb 2023 12:30:46 +0000 (13:30 +0100)]
check-copyright: Don't fail because of the 'glob' module.

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

* check-copyright: Filter out the files from the 'glob' module.

2 years agocheck-copyright: Make output prettier.
Bruno Haible [Tue, 7 Feb 2023 12:17:08 +0000 (13:17 +0100)]
check-copyright: Make output prettier.

* check-copyright: Resize the second column from width 14 to width 17.

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 agoc-nullptr: Fix conflict with libstdc++ in GCC >= 11.
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.

2 years agoc-nullptr: Add tests.
Bruno Haible [Mon, 6 Feb 2023 01:55:47 +0000 (02:55 +0100)]
c-nullptr: Add tests.

* tests/test-nullptr.c: New file.
* modules/c-nullptr-tests: New file.
* tests/test-nullptr-c++.cc: New file.
* modules/c-nullptr-c++-tests: New file.

2 years agosh-quote: backport fix from diffutils
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

2 years agoc-nullptr: new module
Paul Eggert [Sun, 5 Feb 2023 17:47:12 +0000 (09:47 -0800)]
c-nullptr: new module

* doc/gnulib.texi (nullptr): New section.
* doc/posix-headers/stddef.texi: Document lack of nullptr_t.
* m4/c-nullptr.m4, modules/c-nullptr: New files.

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 agofts: pacify GCC 12 -Wstrict-aliasing
Paul Eggert [Sat, 4 Feb 2023 18:28:55 +0000 (10:28 -0800)]
fts: pacify GCC 12 -Wstrict-aliasing

* lib/fts.c (ADJUST): Avoid -Wstrict-aliasing waring.

2 years agofts: pacify GCC 13 -Wuse-after-free
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.

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 agoActivate all existing C++ tests.
Bruno Haible [Sat, 4 Feb 2023 11:53:02 +0000 (12:53 +0100)]
Activate all existing C++ tests.

* modules/assert-h-tests (Depends-on): Add assert-h-c++-tests.
* modules/stdarg-tests (Depends-on): Add stdarg-c++-tests.

2 years agospawn: Fix compilation error on macOS (regression 2023-01-22).
Bruno Haible [Sat, 4 Feb 2023 07:43:50 +0000 (08:43 +0100)]
spawn: Fix compilation error on macOS (regression 2023-01-22).

* lib/spawn.in.h: Tweak logic for defining the POSIX_SPAWN_* constants.

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 agodoc: Update regarding AIX.
Bruno Haible [Sat, 4 Feb 2023 01:47:38 +0000 (02:47 +0100)]
doc: Update regarding AIX.

* doc/glibc-headers/getopt.texi: Update.

2 years agodoc: Update regarding NetBSD.
Bruno Haible [Sat, 4 Feb 2023 01:40:59 +0000 (02:40 +0100)]
doc: Update regarding NetBSD.

* doc/posix-functions/sigprocmask.texi: Mention a NetBSD 9.0 bug.
* doc/posix-functions/pthread_sigmask.texi: Likewise.

2 years agoisnan: update comment
Paul Eggert [Fri, 3 Feb 2023 22:05:16 +0000 (14:05 -0800)]
isnan: update comment

* lib/isnan.c: Update comment for C23.

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 agoUpdate NEWS.
Bruno Haible [Mon, 30 Jan 2023 09:56:14 +0000 (10:56 +0100)]
Update NEWS.

* NEWS: Update for qcopy-acl change on 2023-01-13.

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.
* 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.

2 years agovasnprintf-posix: Fix possible bug with negative width handling for %lc.
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.

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.
* 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.

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.
* 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.

2 years agovasnprintf-posix: Add more unit tests.
Bruno Haible [Sat, 28 Jan 2023 15:58:04 +0000 (16:58 +0100)]
vasnprintf-posix: Add more unit tests.

* tests/test-vasnprintf-posix.c (test_function): Add tests for width
given as argument for the directives %a, %f, %e, %g.
* tests/test-vasprintf-posix.c (test_function): Likewise.
* tests/test-snprintf-posix.h (test_function): Likewise.
* tests/test-sprintf-posix.h (test_function): Likewise.

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 agoalignasof: Ensure a correct _Alignof (regression 2023-01-15).
Bruno Haible [Sat, 28 Jan 2023 01:55:06 +0000 (02:55 +0100)]
alignasof: Ensure a correct _Alignof (regression 2023-01-15).

* m4/stdalign.m4 (gl_ALIGNASOF): Apply the workaround for wrong _Alignof
in GCC < 4.9 and clang < 8.0.0 also when the system has <stdalign.h>.

2 years agostdalign: Ensure alignof is defined on FreeBSD (regression 2023-01-15).
Bruno Haible [Sat, 28 Jan 2023 01:23:36 +0000 (02:23 +0100)]
stdalign: Ensure alignof is defined on FreeBSD (regression 2023-01-15).

* lib/stdalign.in.h: Include the system's <stdalign.h> when it exists.
* m4/stdalign.m4 (gl_ALIGNASOF): Invoke gl_CHECK_NEXT_HEADERS. Set
HAVE_STDALIGN_H.
* modules/stdalign (Makefile.am): Substitute GUARD_PREFIX,
HAVE_STDALIGN_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, PRAGMA_COLUMNS,
NEXT_STDALIGN_H.

2 years agostddef: Fix test-stddef compilation error on FreeBSD 12/x86.
Bruno Haible [Fri, 27 Jan 2023 19:37:19 +0000 (20:37 +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 agoalignasof, stdalign: Fix a compilation error on FreeBSD 12.0.
Bruno Haible [Tue, 24 Jan 2023 12:44:07 +0000 (13:44 +0100)]
alignasof, stdalign: Fix a compilation error on FreeBSD 12.0.

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

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

2 years agodoc: Update list of target platforms.
Bruno Haible [Sun, 22 Jan 2023 15:34:24 +0000 (16:34 +0100)]
doc: Update list of target platforms.

* doc/gnulib-intro.texi (Supported Platforms): Mark musl libc, Android,
and MSVC as "occasionally tested". Update the version numbers of some
OSes. Combine paragraphs regarding mingw and MSVC.
(Formerly Supported Platforms): Mark AIX 5, 6 as "formerly supported".

2 years agoResolve conflicts for functions introduced in Android API level 29.
Bruno Haible [Sun, 22 Jan 2023 13:49:05 +0000 (14:49 +0100)]
Resolve conflicts for functions introduced in Android API level 29.

* m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Conditionally set
REPLACE_REALLOCARRAY.
* lib/stdlib.in.h (reallocarray): Disable _GL_CXXALIASWARN invocation on
non-glibc systems.

2 years agoResolve conflicts for functions introduced in Android API level 29.
Bruno Haible [Sun, 22 Jan 2023 13:47:09 +0000 (14:47 +0100)]
Resolve conflicts for functions introduced in Android API level 29.

* lib/stdlib.in.h (getloadavg): Consider REPLACE_GETLOADAVG. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_GETLOADAVG.
* modules/stdlib (Makefile.am): Substitute REPLACE_GETLOADAVG.
* m4/getloadavg.m4 (gl_GETLOADAVG): Conditionally set
REPLACE_GETLOADAVG.
* modules/getloadavg (Depends-on, configure.ac): Consider
REPLACE_GETLOADAVG.

2 years agoResolve conflicts for functions introduced in Android API level 29.
Bruno Haible [Sun, 22 Jan 2023 13:45:14 +0000 (14:45 +0100)]
Resolve conflicts for functions introduced in Android API level 29.

* lib/time.in.h (timespec_get): Consider REPLACE_TIMESPEC_GET. Disable
_GL_CXXALIASWARN invocation on non-glibc systems.
* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIMESPEC_GET.
* modules/time (Makefile.am): Substitute REPLACE_TIMESPEC_GET.
* m4/gettime.m4 (gl_CHECK_FUNC_TIMESPEC_GET): Set also
gl_cv_onwards_func_timespec_get.
* m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Conditionally set
REPLACE_TIMESPEC_GET.
* modules/timespec_get (Depends-on, configure.ac): Consider
REPLACE_TIMESPEC_GET.

2 years agoResolve conflicts for functions introduced in Android API level 28.
Bruno Haible [Sun, 22 Jan 2023 13:44:44 +0000 (14:44 +0100)]
Resolve conflicts for functions introduced in Android API level 28.

* m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Conditionally set
REPLACE_ALIGNED_ALLOC.
* m4/getrandom.m4 (gl_FUNC_GETRANDOM): Conditionally set
REPLACE_GETRANDOM.

2 years agoResolve conflicts for functions introduced in Android API level 28.
Bruno Haible [Sun, 22 Jan 2023 13:43:32 +0000 (14:43 +0100)]
Resolve conflicts for functions introduced in Android API level 28.

* m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Conditionally set
REPLACE_GETLOGIN_R.
* lib/unistd.in.h (getlogin_r): Disable _GL_CXXALIASWARN invocation on
non-glibc systems.

2 years agoResolve conflicts for functions introduced in Android API level 28.
Bruno Haible [Sun, 22 Jan 2023 13:41:07 +0000 (14:41 +0100)]
Resolve conflicts for functions introduced in Android API level 28.

* m4/spawn_h.m4 (gl_HAVE_POSIX_SPAWN): Conditionally set
REPLACE_POSIX_SPAWN.
* lib/spawn.in.h: Adapt logic for defining the POSIX_SPAWN_* constants.
(posix_spawn, posix_spawnp, posix_spawnattr_init,
posix_spawnattr_destroy, posix_spawnattr_getsigdefault,
posix_spawnattr_setsigdefault, posix_spawnattr_getsigmask,
posix_spawnattr_setsigmask, posix_spawnattr_getflags,
posix_spawnattr_setflags, posix_spawnattr_getpgroup,
posix_spawnattr_setpgroup, posix_spawn_file_actions_init,
posix_spawn_file_actions_destroy, posix_spawn_file_actions_addchdir,
posix_spawn_file_actions_addfchdir): Disable _GL_CXXALIASWARN invocation
on non-glibc systems.

2 years agoResolve conflicts for functions introduced in Android API level 28.
Bruno Haible [Sun, 22 Jan 2023 13:33:37 +0000 (14:33 +0100)]
Resolve conflicts for functions introduced in Android API level 28.

* m4/glob.m4 (gl_GLOB): Conditionally set REPLACE_GLOB.
* lib/glob.in.h (glob): Disable _GL_CXXALIASWARN invocation on non-glibc
systems.