]> Savannah Git Hosting - gnulib.git/log
gnulib.git
19 months agototalorderl: Work around Solaris cc bug.
Bruno Haible [Wed, 4 Oct 2023 10:47:23 +0000 (12:47 +0200)]
totalorderl: Work around Solaris cc bug.

* lib/totalorderl.c (totalorderl): Initialize xu, yu, zu using a
different syntax.

19 months agosignbit tests: Strengthen tests.
Bruno Haible [Wed, 4 Oct 2023 08:20:22 +0000 (10:20 +0200)]
signbit tests: Strengthen tests.

* tests/test-signbit.c (test_signbitf, test_signbitd, test_signbitl):
Test the sign bit both of a NaN value and of its negative.

19 months agodoc: Document portability of __VA_ARGS__.
Bruno Haible [Tue, 3 Oct 2023 22:55:14 +0000 (00:55 +0200)]
doc: Document portability of __VA_ARGS__.

* doc/gnulib-readme.texi (C99 features assumed): Add a note about
__VA_ARGS__.

19 months agoilogb: Document a Mac OS X bug.
Bruno Haible [Tue, 3 Oct 2023 22:30:28 +0000 (00:30 +0200)]
ilogb: Document a Mac OS X bug.

* doc/posix-functions/ilogb.texi: Mention a bug that affects Mac OS X.
* m4/ilogb.m4 (gl_FUNC_ILOGB): Update comments.

19 months ago*printf-posix: Work around bug with %#.0x on Mac OS X 10.6.
Bruno Haible [Tue, 3 Oct 2023 21:27:30 +0000 (23:27 +0200)]
*printf-posix: Work around bug with %#.0x on Mac OS X 10.6.

* lib/vasnprintf.c (VASNPRINTF): Enable NEED_PRINTF_UNBOUNDED_PRECISION-
guarded code also for NEED_PRINTF_FLAG_ALT_PRECISION_ZERO. Set
prec_ourselves to 1 if NEED_PRINTF_FLAG_ALT_PRECISION_ZERO, precision is
0, and the directive is 'x' or 'X'. If prec_ourselves, remove the "0"
output if required.
* m4/printf.m4 (gl_PRINTF_FLAG_ALT_PRECISION_ZERO): New macro.
* m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO): New
macro.
(gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS): Invoke it.
* m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_IS_POSIX): Require
gl_PRINTF_FLAG_ALT_PRECISION_ZERO and test its result.
* m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_IS_POSIX): Likewise.
* m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_IS_POSIX):
Likewise.
* m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_IS_POSIX): Likewise.
* m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_IS_POSIX): Likewise.
* m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_IS_POSIX): Likewise.
* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Likewise.
* m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_IS_POSIX): Likewise.
* m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_IS_POSIX): Likewise.
* m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_IS_POSIX): Likewise.
* m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_IS_POSIX): Likewise.
* doc/glibc-functions/asprintf.texi: Mention the %#.0x bug.
* doc/glibc-functions/obstack_printf.texi: Likewise.
* doc/glibc-functions/obstack_vprintf.texi: Likewise.
* doc/glibc-functions/vasprintf.texi: Likewise.
* doc/posix-functions/dprintf.texi: Likewise.
* doc/posix-functions/fprintf.texi: Likewise.
* doc/posix-functions/fwprintf.texi: Likewise.
* doc/posix-functions/printf.texi: Likewise.
* doc/posix-functions/snprintf.texi: Likewise.
* doc/posix-functions/sprintf.texi: Likewise.
* doc/posix-functions/swprintf.texi: Likewise.
* doc/posix-functions/vdprintf.texi: Likewise.
* doc/posix-functions/vfprintf.texi: Likewise.
* doc/posix-functions/vfwprintf.texi: Likewise.
* doc/posix-functions/vprintf.texi: Likewise.
* doc/posix-functions/vsnprintf.texi: Likewise.
* doc/posix-functions/vsprintf.texi: Likewise.
* doc/posix-functions/vswprintf.texi: Likewise.
* doc/posix-functions/vwprintf.texi: Likewise.
* doc/posix-functions/wprintf.texi: Likewise.

19 months agofaccessat tests: Strengthen tests.
Bruno Haible [Tue, 3 Oct 2023 17:06:00 +0000 (19:06 +0200)]
faccessat tests: Strengthen tests.

* tests/test-faccessat.c (main): Test other modes than F_OK. Check errno
values.

19 months agoeuidaccess: Reject trailing slashes on symlinks to non-directories.
Bruno Haible [Tue, 3 Oct 2023 16:13:54 +0000 (18:13 +0200)]
euidaccess: Reject trailing slashes on symlinks to non-directories.

* modules/euidaccess (Depends-on): Add access.

19 months agoeuidaccess: Add tests.
Bruno Haible [Tue, 3 Oct 2023 14:42:59 +0000 (16:42 +0200)]
euidaccess: Add tests.

* tests/test-access.h: New file, extracted from tests/test-access.c.
* tests/test-access.c: Moved most code to tests/test-access.h.
Include test-access.h.
(main): Invoke test_access.
* tests/test-euidaccess.c: New file, based on tests/test-access.c.
* modules/access-tests (Files): Add tests/test-access.h.
* modules/euidaccess-tests: New file, based on modules/access-tests.

19 months agoaccess: Make last change work also when module 'stat' is in use.
Bruno Haible [Tue, 3 Oct 2023 15:59:38 +0000 (17:59 +0200)]
access: Make last change work also when module 'stat' is in use.

* lib/access.c (access): When stat() returns -1 with errno != EOVERFLOW,
fail.

19 months agoaccess: Work around trailing slash bug on Mac OS X 10.5.
Bruno Haible [Tue, 3 Oct 2023 13:59:57 +0000 (15:59 +0200)]
access: Work around trailing slash bug on Mac OS X 10.5.

* m4/access.m4 (gl_FUNC_ACCESS): Test whether access honors a trailing
slash. Set REPLACE_ACCESS to 1 and define ACCESS_TRAILING_SLASH_BUG if
not.
* lib/access.c (access): Add an implementation for Unix-like platforms.
* tests/test-access.c (main): Test for result if the argument has a
trailing slash.
* modules/access-tests (Depends-on): Add 'symlink'.
* doc/posix-functions/access.texi: Mention the Mac OS X bug.

19 months agoupdate-copyright tests: Fix test failure (regression 2023-06-18).
Bruno Haible [Tue, 3 Oct 2023 12:44:21 +0000 (14:44 +0200)]
update-copyright tests: Fix test failure (regression 2023-06-18).

* build-aux/update-copyright: Add "use re 'eval';" declaration.

19 months agoUpdate re *-*-windows*-gnu* config triplets, withdrawn on 2023-09-19.
Bruno Haible [Tue, 3 Oct 2023 10:30:06 +0000 (12:30 +0200)]
Update re *-*-windows*-gnu* config triplets, withdrawn on 2023-09-19.

* m4/*.m4: Don't recognize windows*-gnu* as equivalent to mingw*.

19 months agostring-c++-tests, uchar-c++-tests: Fix link errors on Mac OS X.
Bruno Haible [Tue, 3 Oct 2023 08:51:06 +0000 (10:51 +0200)]
string-c++-tests, uchar-c++-tests: Fix link errors on Mac OS X.

* modules/string-c++-tests (Makefile.am): Link test-string-c++ with
$(LIBC32CONV).
* modules/uchar-c++-tests (Makefile.am): Link test-uchar-c++ with
$(LIBC32CONV).

19 months agomcel tests: Fix link error.
Bruno Haible [Tue, 3 Oct 2023 08:24:46 +0000 (10:24 +0200)]
mcel tests: Fix link error.

* modules/mcel-tests (Makefile.am): Link test-mcel with $(LIBUNISTRING)
$(SETLOCALE_LIB) $(MBRTOWC_LIB) $(LIBC32CONV).

19 months agomcel: Fix compilation error in tests.
Bruno Haible [Tue, 3 Oct 2023 08:16:01 +0000 (10:16 +0200)]
mcel: Fix compilation error in tests.

* lib/mcel.h (mcel_scan): Undefine 'mbs' after use.

19 months agolocalename, gettext: Avoid crash on macOS 14.
Bruno Haible [Mon, 2 Oct 2023 22:28:31 +0000 (00:28 +0200)]
localename, gettext: Avoid crash on macOS 14.

Reported by Shupeng Xue <dspxue@gmail.com> at
<https://lists.gnu.org/archive/html/bug-gettext/2023-10/msg00001.html>.

Cf <https://github.com/aria2/aria2/issues/2083#issuecomment-1694662007>.

* m4/intlmacosx.m4 (gt_INTL_MACOSX): Link with the CoreServices
framework in addition to the CoreFoundation framework.

19 months agolocalcharset: Avoid internal compiler error with -Wextra on macOS 10.5.
Bruno Haible [Mon, 2 Oct 2023 22:10:08 +0000 (00:10 +0200)]
localcharset: Avoid internal compiler error with -Wextra on macOS 10.5.

* lib/localcharset.c (locale_charset): Use an empty compound statement
instead of a null statement.

19 months agofchdir: Fix a compilation error on OS/2 kLIBC (regression 2023-09-29).
KO Myung-Hun [Mon, 2 Oct 2023 14:07:43 +0000 (23:07 +0900)]
fchdir: Fix a compilation error on OS/2 kLIBC (regression 2023-09-29).

In fdopendir.c, GNULIB_defined_DIR requires REPLACE_FCHDIR to be defined.

* m4/fchdir.m4 (gl_FUNC_FCHDIR): Define REPLACE_FCHDIR macro to 1 if
REPLACE_FCHDIR is 1.

19 months agototalorder, totalorderf, totalorderl: Fix some typos.
Bruno Haible [Mon, 2 Oct 2023 11:25:12 +0000 (13:25 +0200)]
totalorder, totalorderf, totalorderl: Fix some typos.

* m4/totalorder.m4 (gl_FUNC_TOTALORDERF): Assign TOTALORDERF_LIBM, not
TOTALORDER_LIBM.
* modules/totalorder (Description): Fix copy&paste mistake.
(Depends-on): Fix conditions.
* modules/totalorderf (Depends-on): Likewise.
* modules/totalorderl (Depends-on): Likewise.

19 months agototalorder, totalorderf, totalorderl: new modules
Paul Eggert [Mon, 2 Oct 2023 04:46:01 +0000 (21:46 -0700)]
totalorder, totalorderf, totalorderl: new modules

* lib/math.in.h: Declare totalorderf, totalorder, totalorderl.
* lib/totalorder.c, lib/totalorderf.c, lib/totalorderl.c:
* m4/totalorder.m4, modules/totalorder, modules/totalorder-tests:
* modules/totalorderf, modules/totalorderf-tests:
* modules/totalorderl, modules/totalorderl-tests:
* tests/test-totalorder.c, tests/test-totalorderf.c:
* tests/test-totalorderl.c: New files.
* m4/math_h.m4 (gl_MATH_H, gl_MATH_H_REQUIRE_DEFAULTS)
(gl_MATH_H_DEFAULTS):
* modules/math (math.h): Set up totalorder, totalorderf, totalorderl.
* m4/mathfunc.m4 (gl_MATHFUNC): Also support pointer-to-const.

19 months agoregex-quote: fix recently-introduced typo
Paul Eggert [Sun, 1 Oct 2023 01:03:48 +0000 (18:03 -0700)]
regex-quote: fix recently-introduced typo

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2023-09/msg00146.html
* lib/regex-quote.c (regex_quote_copy): Add missing #endif.

19 months agowgetcwd-lgpl: Add tests.
Bruno Haible [Sat, 30 Sep 2023 14:23:28 +0000 (16:23 +0200)]
wgetcwd-lgpl: Add tests.

* tests/test-wgetcwd-lgpl.c: New file, based on
tests/test-getcwd-lgpl.c.
* modules/wgetcwd-lgpl-tests: New file, based on
modules/getcwd-lgpl-tests.

19 months agowgetcwd-lgpl: New module.
Bruno Haible [Sat, 30 Sep 2023 14:20:14 +0000 (16:20 +0200)]
wgetcwd-lgpl: New module.

* lib/wchar.in.h (wgetcwd): New declaration.
* lib/wgetcwd-lgpl.c: New file, based on lib/getcwd-lgpl.c.
* m4/wchar_h.m4 (gl_WCHAR_H_REQUIRE_DEFAULTS): Initialize
GNULIB_WGETCWD.
* modules/wchar (Makefile.am): Substitute GNULIB_WGETCWD.
* modules/wgetcwd-lgpl: New file.

19 months agogetcwd-lgpl: Tweaks.
Bruno Haible [Sat, 30 Sep 2023 14:15:44 +0000 (16:15 +0200)]
getcwd-lgpl: Tweaks.

* lib/unistd.in.h (getcwd): Mention the module 'getcwd-lgpl'.
* lib/getcwd-lgpl.c (rpl_getcwd): Minimize scope of local variables.
* tests/test-getcwd-lgpl.c (main): Use GNU coding style.

19 months agoAllow different --libtool options from multiple gnulib-tool invocations.
Bruno Haible [Fri, 29 Sep 2023 21:01:30 +0000 (23:01 +0200)]
Allow different --libtool options from multiple gnulib-tool invocations.

* modules/crypto/gc (Makefile.am): Don't test GL_COND_LIBTOOL, since
gnulib-tool already eliminates lib_LDFLAGS augmentations for non-libtool
libraries.
* modules/striconv (Makefile.am): Likewise.
* modules/striconveh (Makefile.am): Likewise.
* modules/termcap (Makefile.am): Likewise.
* modules/terminfo (Makefile.am): Likewise.

19 months agostdlib: Cast putenv() on OS/2 kLIBC
KO Myung-Hun [Mon, 25 Sep 2023 15:20:12 +0000 (00:20 +0900)]
stdlib: Cast putenv() on OS/2 kLIBC

On OS/2 kLIBC, the first parameter of putenv () is 'const char *string'
not 'char *string'.

* lib/stdlib.in.h (putenv) [kLIBC]: Cast with _GL_CXXALIAS_SYS_CAST().

19 months agofchdir: Override properly on OS/2 kLIBC.
Bruno Haible [Fri, 29 Sep 2023 08:46:15 +0000 (10:46 +0200)]
fchdir: Override properly on OS/2 kLIBC.

* lib/unistd.in.h (fchdir): Override if REPLACE_FCHDIR is 1.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_FCHDIR.
* modules/unistd (Makefile.am): Substitute REPLACE_FCHDIR.
* modules/fchdir (Depends-on, configure.ac): Test REPLACE_FCHDIR.
* m4/fchdir.m4 (gl_FUNC_FCHDIR): Instead of setting HAVE_FCHDIR to 0,
set REPLACE_FCHDIR to 1.

19 months agofdopendir: Use Windows code path on OS/2 kLIBC
KO Myung-Hun [Mon, 25 Sep 2023 14:38:28 +0000 (23:38 +0900)]
fdopendir: Use Windows code path on OS/2 kLIBC

* lib/closedir.c (closedir): Use Windows code path.
* lib/dirent.in.h (_gl_register_dirp_fd, _gl_unregister_dirp_fd):
Remove.
* lib/dirfd.c (_gl_register_dirp_fd, _gl_unregister_dirp_fd): Remove.
(dirfd): Use Windows code path.
* lib/fdopendir.c (fdopendir): Use Windows code path.
* lib/opendir.c (opendir): Use Windows code path.
* m4/closedir.m4 (REPLACE_CLOSEDIR): Use Windows code path.
* m4/dirent_h.m4 (DIR_HAS_FD_MEMBER): Use Windows code path.
* m4/dirfd.m4 (REPLACE_DIRFD): Use Windows code path.
* m4/fchdir.m4 (HAVE_FCHDIR): Replace fchdir() if dirfd() does not work.
* m4/opendir.m4 (REPLACE_OPENDIR): Use Windows code path.
* m4/readdir.m4 (REPLACE_READDIR): Use Windows code path.
* m4/rewinddir.m4 (REPLACE_REWINDDIR): Use Windows code path.
* modules/fchdir (Depends-on): Include dirent always.

19 months agomcel-bench-tests: fix typo
Paul Eggert [Tue, 26 Sep 2023 22:49:49 +0000 (15:49 -0700)]
mcel-bench-tests: fix typo

* tests/bench-mcel.c (main): Fix typo in usage message.

19 months agoRemaining support for GNULIB_MCEL_PREFER
Paul Eggert [Tue, 26 Sep 2023 22:49:02 +0000 (15:49 -0700)]
Remaining support for GNULIB_MCEL_PREFER

Support mcel API in remaining modules where this might matter,
for apps that prefer it.
* lib/mbmemcasecmp.c, lib/mbscspn.c, lib/mbsncasecmp.c, lib/mbsnlen.c:
* lib/mbspbrk.c, lib/mbspcasecmp.c, lib/mbssep.c, lib/mbsspn.c:
* lib/regex-quote.c:
Include mcel.h instead of mbiterf.h or mbuiterf.h,
if GNULIB_MCEL_PREFER.
* lib/mbmemcasecmp.c (mbmemcasecmp), lib/mbscspn.c (mbscspn):
* lib/mbsncasecmp.c (mbsncasecmp), lib/mbsnlen.c (mbsnlen):
* lib/mbspbrk.c (mbspbrk), lib/mbspcasecmp.c (mbspcasecmp):
* lib/mbssep.c (mbssep), lib/mbsspn.c (mbsspn):
* lib/regex-quote.c (regex_quote_length, regex_quote_copy):
Use mcel API, if GNULIB_MCEL_PREFER.
* lib/mbscspn.c, lib/mbspbrk.c, lib/mbspcasecmp.c, lib/mbsspn.c:
Include stdlib.h, for MB_CUR_MAX.
* modules/mbmemcasecmp, modules/mbsncasecmp, modules/mbspcasecmp:
Depend on c32tolower.
* modules/regex-quote: Depend on mempcpy.

19 months agombscasestr: support GNULIB_MCEL_PREFER
Paul Eggert [Tue, 26 Sep 2023 06:01:55 +0000 (23:01 -0700)]
mbscasestr: support GNULIB_MCEL_PREFER

Support mcel API for apps that prefer it.
This mirrors the recent changes to mbsstr.
* lib/mbscasestr.c [GNULIB_MCEL_PREFER]: Include mcel.h not mbuiter.h.
(mbchar_t, mb_equal) [GNULIB_MCEL_PREFER]: New type and function,
to make it easier to use common code.
(knuth_morris_pratt_multibyte): Don't assume mbchar_t's alignment
is at least that of size_t.
(knuth_morris_pratt_multibyte, mbscasestr) [GNULIB_MCEL_PREFER]:
Use mcel API.
* modules/mbscasestr (Depends-on): Add alignasof.

19 months agomaintainer-makefile: Fix syntax-check rules wrt README.
Bernhard Voelker [Sun, 24 Sep 2023 16:13:50 +0000 (18:13 +0200)]
maintainer-makefile: Fix syntax-check rules wrt README.

* top/maint.mk (sc_readme_link_install): Change the value of the
variable in_vc_files to contain a pattern for the README file.
(sc_readme_link_copying): Likewise.
Previously, the above rules always passed, because the generated
list of files was empty.  Bug introduced when adding the rules
in commit 53b4bf3018.

19 months agoautoupdate
Karl Berry [Fri, 22 Sep 2023 15:40:19 +0000 (08:40 -0700)]
autoupdate

19 months agostriconveh, *vasnprintf, vasnwprintf: Make more virtual-memory friendly.
Bruno Haible [Fri, 22 Sep 2023 07:36:13 +0000 (09:36 +0200)]
striconveh, *vasnprintf, vasnwprintf: Make more virtual-memory friendly.

* lib/striconveh.c (mem_cd_iconveh_internal): Mark hex as 'const'.
* lib/vasnprintf.c (wctomb_fallback): Likewise.

19 months agostriconveh, *vasnprintf, vasnwprintf: Make more shared-library friendly.
Bruno Haible [Fri, 22 Sep 2023 07:23:32 +0000 (09:23 +0200)]
striconveh, *vasnprintf, vasnwprintf: Make more shared-library friendly.

* lib/striconveh.c (mem_cd_iconveh_internal): Mark hex as 'const'.
* lib/vasnprintf.c (wctomb_fallback): Likewise.

19 months agombschr, mbsrchr: support GNULIB_MCEL_PREFER
Paul Eggert [Thu, 21 Sep 2023 19:46:52 +0000 (12:46 -0700)]
mbschr, mbsrchr: support GNULIB_MCEL_PREFER

Support mcel API for apps that prefer it.
* lib/mbschr.c, lib/mbsrchr.c: Include stdlib.h, for MB_CUR_MAX.
[GNULIB_MCEL_PREFER]: Include mcel.h instead of mbuiterf.h.
(mbschr, mbsrchr) [GNULIB_MCEL_PREFER]: Use mcel API.

19 months agognulib-common: don’t suppress -Wpedantic
Paul Eggert [Thu, 21 Sep 2023 21:26:24 +0000 (14:26 -0700)]
gnulib-common: don’t suppress -Wpedantic

Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/bug-gnulib/2023-09/msg00130.html
* m4/gnulib-common.m4 (_GL_HAVE___HAS_C_ATTRIBUTE): New macro.
Use it instead of ‘defined __has_c_attribute’.

19 months agocrypto/sm3: rename gl_cv_* variable for clarity
Paul Eggert [Thu, 21 Sep 2023 21:23:58 +0000 (14:23 -0700)]
crypto/sm3: rename gl_cv_* variable for clarity

* m4/gc-sm3.m4 (gl_cv_libgcrypt_md_sm3):
Rename from gl_cv_libcrypt_md_sm3 since this is unrelated to libcrypt.

19 months agoautoupdate
Karl Berry [Thu, 21 Sep 2023 14:07:09 +0000 (07:07 -0700)]
autoupdate

19 months agoautoupdate
Karl Berry [Tue, 19 Sep 2023 16:11:24 +0000 (09:11 -0700)]
autoupdate

19 months agointprops: pacify GCC -Wtype-limits
Paul Eggert [Sun, 17 Sep 2023 21:34:43 +0000 (14:34 -0700)]
intprops: pacify GCC -Wtype-limits

* lib/intprops-internal.h: Pacify gcc (GCC) 13.2.1 20230728 (Red
Hat 13.2.1-1) x86-64 -Wtype-limits on bleeding-edge diffutils.

19 months agolib-symbol-visibility: Fix a misnomer.
Bruno Haible [Sat, 16 Sep 2023 09:28:23 +0000 (11:28 +0200)]
lib-symbol-visibility: Fix a misnomer.

* doc/lib-symbol-visibility.texi: Rename LIBFOO_DLL_EXPORTED to
LIBFOO_SHLIB_EXPORTED. Prefer the term "shared library", since the term
"DLL" applies only to Windows.
* lib/relocatable.h (RELOCATABLE_SHLIB_EXPORTED): Renamed from
RELOCATABLE_DLL_EXPORTED. Prefer the term "shared library", since the
term "DLL" applies only to Windows.
* lib/mbtowc-lock.c (SHLIB_EXPORTED): Renamed from DLL_EXPORTED.
* lib/nl_langinfo-lock.c (SHLIB_EXPORTED): Likewise.
* lib/setlocale-lock.c (SHLIB_EXPORTED): Likewise.

19 months agoacl-permissions: Fix compilation error on Solaris 11 (regr. 2023-09-04).
Bruno Haible [Fri, 15 Sep 2023 23:09:31 +0000 (01:09 +0200)]
acl-permissions: Fix compilation error on Solaris 11 (regr. 2023-09-04).

* lib/set-permissions.c: Include minmax.h.
* modules/acl-permissions (Depends-on): Add minmax.

19 months agoreadutmp: Fix crash when gdm is in use.
Bruno Haible [Fri, 15 Sep 2023 15:40:10 +0000 (17:40 +0200)]
readutmp: Fix crash when gdm is in use.

Reported by Thorsten Kukuk <kukuk@suse.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-09/msg00093.html>.

* lib/readutmp.c (read_utmp_from_systemd): Don't use the value returned
by sd_session_get_display if it is NULL.

19 months agodoc: Mention libucontext.
Bruno Haible [Thu, 14 Sep 2023 14:03:36 +0000 (16:03 +0200)]
doc: Mention libucontext.

* doc/pastposix-functions/getcontext.texi: Mention libucontext.
* doc/pastposix-functions/makecontext.texi: Likewise.
* doc/pastposix-functions/setcontext.texi: Likewise.
* doc/pastposix-functions/swapcontext.texi: Likewise.

19 months agoautoupdate
Karl Berry [Thu, 14 Sep 2023 13:52:49 +0000 (06:52 -0700)]
autoupdate

19 months agombfile: Add tests.
Bruno Haible [Wed, 13 Sep 2023 14:31:56 +0000 (16:31 +0200)]
mbfile: Add tests.

* tests/test-mbfile.sh: New file.
* tests/test-mbfile.c: New file.
* modules/mbfile-tests: New file.

19 months agombfile: Fix major bug (regression 2023-07-04).
Bruno Haible [Wed, 13 Sep 2023 14:23:35 +0000 (16:23 +0200)]
mbfile: Fix major bug (regression 2023-07-04).

Reported by Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-09/msg00088.html>.

* lib/mbfile.h (mbfile_multi_getc): If bytes != -1, -2, -3, add the
previous mbf->bufcount to bytes.

19 months agognu-web-doc-update: fix updating of manual directory
Pádraig Brady [Mon, 11 Sep 2023 18:31:53 +0000 (19:31 +0100)]
gnu-web-doc-update: fix updating of manual directory

* build-aux/gnu-web-doc-update: Correctly change to the 'manual' directory,
since $tmp is a relative path.  This avoids removing files
outside of the 'manual' directory.  Broken since commit e979787d.

19 months agoFix clang errors "different exception specifier" (regr. 2023-09-04).
Bruno Haible [Sun, 10 Sep 2023 21:33:41 +0000 (23:33 +0200)]
Fix clang errors "different exception specifier" (regr. 2023-09-04).

* lib/malloc.in.h (memalign): Don't use _GL_ATTRIBUTE_NOTHROW on
platforms other than glibc systems.
* lib/stdio.in.h (fdopen): Likewise.
* lib/stdlib.in.h (aligned_alloc, calloc, canonicalize_file_name,
malloc, realloc): Likewise.
* lib/string.in.h (strdup, strndup): Likewise.
* lib/sys_stat.in.h (getumask): Likewise.
* lib/wchar.in.h (wcsdup): Likewise.

19 months agopropername: support GNULIB_MCEL_PREFER
Paul Eggert [Sun, 10 Sep 2023 00:44:12 +0000 (17:44 -0700)]
propername: support GNULIB_MCEL_PREFER

Support mcel API for apps that prefer it.
The following changes are in effect only if GNULIB_MCEL_PREFER.
* lib/propername.c: Include mcel.h, not mbchar.h and mbuiter.h.
(mbsstr_trimmed_wordbounded): Use mcel API.
* modules/propername (Depends-on): Add c32isalnum.

19 months agotrim: support GNULIB_MCEL_PREFER
Paul Eggert [Sun, 10 Sep 2023 00:22:19 +0000 (17:22 -0700)]
trim: support GNULIB_MCEL_PREFER

Support mcel API for apps that prefer it.
The following changes are in effect only if GNULIB_MCEL_PREFER.
* lib/trim.c: Include mcel.h, not mbchar.h and mbuiterf.h.
(trim2): Use mcel API.
* modules/trim (Depends-on): Add c32isspace.

19 months agombsstr: support GNULIB_MCEL_PREFER
Paul Eggert [Sun, 10 Sep 2023 00:14:15 +0000 (17:14 -0700)]
mbsstr: support GNULIB_MCEL_PREFER

Support mcel API for apps that prefer it.
* lib/mbsstr.c [GNULIB_MCEL_PREFER]: Include mcel.h not mbuiter.h.
(mbchar_t, mb_equal) [GNULIB_MCEL_PREFER]: New type and function,
to make it easier to use common code.
(knuth_morris_pratt_multibyte): Don't assume mbchar_t's alignment
is at least that of size_t.
(knuth_morris_pratt_multibyte, mbsstr) [GNULIB_MCEL_PREFER]:
Use mcel API.
* modules/mbsstr (Depends-on): Add alignasof.

19 months agombslen: support GNULIB_MCEL_PREFER
Paul Eggert [Sat, 9 Sep 2023 22:47:27 +0000 (15:47 -0700)]
mbslen: support GNULIB_MCEL_PREFER

Support mcel API for apps that prefer it.
The following changes are in effect only if GNULIB_MCEL_PREFER.
* lib/mbslen.c: Include mcel.h instead of mbuiterf.h.
(mbslen): Use mcel API.

19 months agoRemove tabs from mcel.h, mountlist.h, verify.h
Paul Eggert [Sat, 9 Sep 2023 17:13:50 +0000 (10:13 -0700)]
Remove tabs from mcel.h, mountlist.h, verify.h

19 months agochown: work around symlink issues on odd platforms
Paul Eggert [Sat, 9 Sep 2023 16:53:02 +0000 (09:53 -0700)]
chown: work around symlink issues on odd platforms

Problem reported by Jordi Sanfeliu in:
https://lists.gnu.org/archive/html/bug-gnulib/2023-07/msg00116.html
* lib/chown.c (rpl_chown) [CHOWN_MODIFIES_SYMLINK]:
Do not declare unused locals st, stat_valid.
Redo to just call chown if arg is a symlink.
This induces a race but is perhaps the best we can do easily
on oddball platforms where chown does not follow symlinks.

19 months agochown, lchown: Revisit platforms.
Bruno Haible [Sat, 9 Sep 2023 09:26:46 +0000 (11:26 +0200)]
chown, lchown: Revisit platforms.

* doc/posix-functions/chown.texi: Update platforms list.
* doc/posix-functions/lchown.texi: Likewise.
* lib/chown.c (rpl_chown): Add platform comments.
* lib/lchown.c: Likewise.

19 months agoUpdate strings doc
Paul Eggert [Thu, 7 Sep 2023 21:51:58 +0000 (14:51 -0700)]
Update strings doc

* doc/strings.texi: Mention mbiterf, mbuiterf, mcel, and mcel-prefer.

19 months agombscasecmp: support GNULIB_MCEL_PREFER
Paul Eggert [Thu, 7 Sep 2023 21:51:58 +0000 (14:51 -0700)]
mbscasecmp: support GNULIB_MCEL_PREFER

* lib/mbscasecmp.c: Include stdlib.h, since we use MB_CUR_MAX.
Include uchar.h, for c32tolower.
(GNULIB_MCEL_PREFER): Include mcel.h instead of mbuiterf.h.
(mbscasecmp) [GNULIB_MCEL_PREFER]: Use mcel instead of mbuiterf.
* modules/mbscasecmp (Depends-on): Add c32tolower, stdlib, uchar.
Depend on mbuiterf only if not preferring mcel.

19 months agoexclude: support GNULIB_MCEL_PREFER
Paul Eggert [Thu, 7 Sep 2023 21:51:58 +0000 (14:51 -0700)]
exclude: support GNULIB_MCEL_PREFER

Support mcel API for apps that prefer it.
The following changes are in effect only if GNULIB_MCEL_PREFER.
* lib/exclude.c: Include mcel.h instead of mbuiter.h.
(string_hasher_ci): Use mcel_scanz instead of mbui_init,
mbui_avail, mbui_cur, and mbui_advance.
* modules/exclude: Do not depend on mbuiter.

19 months agomcel-prefer: new module
Paul Eggert [Thu, 7 Sep 2023 21:51:57 +0000 (14:51 -0700)]
mcel-prefer: new module

* modules/mcel-prefer: New file.

19 months agomcel-bench-tests: new module
Paul Eggert [Thu, 7 Sep 2023 21:51:56 +0000 (14:51 -0700)]
mcel-bench-tests: new module

* modules/mcel-bench-tests, tests/bench-mcel.c: New files.
* tests/bench-multibyte.h (TEXT_LATIN_ASCII_LINE1)
(TEXT_FRENCH_UTF8_LINE1, TEXT_GREEK_UTF8_LINE1)
(TEXT_CHINESE_UTF8_LINE1): New macros.
(text_random_bytes): New constant.
* tests/bench.h (timing_output): Mark with _GL_UNUSED,
since bench-mcel.c does not use it.

19 months agomcel-tests: new module
Paul Eggert [Thu, 7 Sep 2023 21:51:56 +0000 (14:51 -0700)]
mcel-tests: new module

* modules/mcel-tests, tests/test-mcel.c: New files

19 months agomcel: new module
Paul Eggert [Thu, 7 Sep 2023 21:51:55 +0000 (14:51 -0700)]
mcel: new module

* lib/mcel.c, lib/mcel.h, modules/mcel: New files.

19 months agoDon't use 'throw ()' in C++ 11 or newer.
Bruno Haible [Thu, 7 Sep 2023 20:22:43 +0000 (22:22 +0200)]
Don't use 'throw ()' in C++ 11 or newer.

* lib/stddef.in.h (_GL_ATTRIBUTE_NOTHROW):  Provide fallback definition.
(abort): Declare with _GL_ATTRIBUTE_NOTHROW instead of throw().
* lib/malloc.in.h (rpl_free, free): Likewise.
* lib/stdlib.in.h (free): Likewise.
* lib/string.in.h (rpl_free, free, memchr, memrchr, rawmemchr,
strchrnul, strpbrk, strstr, strcasestr): Likewise.
* lib/wchar.in.h (rpl_free, free): Likewise.
* lib/getopt-cdefs.in.h (__THROW): Define to noexcept(true) for C++ 11
or newer.
* lib/md5.h (__THROW): Likewise.

19 months agoAdd info about recommended warning options with clang.
Bruno Haible [Thu, 7 Sep 2023 15:49:48 +0000 (17:49 +0200)]
Add info about recommended warning options with clang.

* HACKING (Warning Options): Add info regarding clang.

19 months agouchar: Fix references to overridden functions with GNULIB_NAMESPACE.
Bruno Haible [Thu, 7 Sep 2023 12:39:12 +0000 (14:39 +0200)]
uchar: Fix references to overridden functions with GNULIB_NAMESPACE.

* lib/uchar.in.h (btoc32, c32isalnum, c32isalpha, c32isblank,
c32iscntrl, c32isdigit, c32isgraph, c32islower, c32isprint, c32ispunct,
c32isspace, c32isupper, c32isxdigit, c32tolower, c32toupper, c32width,
c32snrtombs, c32srtombs, c32swidth, c32tob, mbsnrtoc32s, mbsrtoc32s,
c32_get_type_test, c32_apply_type_test, c32_get_mapping,
c32_apply_mapping): Use GNULIB_NAMESPACE:: prefix to refer to the gnulib
overridden function.
* modules/uchar (Depends-on): Add wctype-h.
(Makefile.am): Substitute GNULIB_BTOWC, GNULIB_ISWDIGIT,
GNULIB_ISWXDIGIT, GNULIB_WCWIDTH, GNULIB_WCSNRTOMBS, GNULIB_WCSRTOMBS,
GNULIB_WCSWIDTH, GNULIB_WCTOB, GNULIB_MBSNRTOWCS, GNULIB_MBSRTOWCS,
GNULIB_WCTYPE, GNULIB_ISWCTYPE, GNULIB_WCTRANS, GNULIB_TOWCTRANS.

19 months agotests: Fix some clang -Wimplicit-fallthrough warnings.
Bruno Haible [Thu, 7 Sep 2023 14:13:22 +0000 (16:13 +0200)]
tests: Fix some clang -Wimplicit-fallthrough warnings.

* tests/test-execute-main.c (main): Add 'break' statement.
* tests/test-sys_file.c (main): Likewise.

19 months agounictype/category-none: Fix clang -Wpedantic warning.
Bruno Haible [Thu, 7 Sep 2023 14:05:33 +0000 (16:05 +0200)]
unictype/category-none: Fix clang -Wpedantic warning.

* lib/unictype/categ_none.c (_UC_CATEGORY_NONE): Use ISO C designated
initializer syntax to initialize the intended field of the union.

19 months agoc-*snprintf: Fix some clang -Wmissing-prototypes warnings.
Bruno Haible [Thu, 7 Sep 2023 14:21:25 +0000 (16:21 +0200)]
c-*snprintf: Fix some clang -Wmissing-prototypes warnings.

* lib/c-snprintf.c: Include c-snprintf.h instead of <stdio.h>.
* lib/c-vsnprintf.c: Include c-vsnprintf.h instead of <stdio.h>.
* lib/c-vasnprintf.c: Include c-vasnprintf.h.

19 months agoargp: Fix clang -Wextra-semi-stmt warning.
Bruno Haible [Thu, 7 Sep 2023 00:25:30 +0000 (02:25 +0200)]
argp: Fix clang -Wextra-semi-stmt warning.

* lib/argp-help.c (SKIPWS): Remove trailing semicolon.

19 months agodoc: Refine documentation of MSVC support for shared libraries.
Bruno Haible [Thu, 7 Sep 2023 00:20:05 +0000 (02:20 +0200)]
doc: Refine documentation of MSVC support for shared libraries.

* doc/lib-symbol-visibility.texi (Exported Symbols of Shared Libraries):
Recommend to define BUILDING_SHARED as an Autoconf variable. Recommend
to test DLL_EXPORT.

19 months agodoc: Fix syntax error (regression 2023-09-03).
Bruno Haible [Thu, 7 Sep 2023 00:06:01 +0000 (02:06 +0200)]
doc: Fix syntax error (regression 2023-09-03).

* doc/posix-headers/sys_stat.texi: Correct @itemize / @end itemize
nesting.

20 months agorelocatable-lib-lgpl: Don't export symbols from static MSVC .obj files.
Bruno Haible [Wed, 6 Sep 2023 00:03:37 +0000 (02:03 +0200)]
relocatable-lib-lgpl: Don't export symbols from static MSVC .obj files.

Reported by Dmitry Bely <dmitry.bely@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnu-libiconv/2023-08/msg00002.html>.

* lib/relocatable.h (RELOCATABLE_DLL_EXPORTED): Don't use
__declspec(dllexport) when creating static .obj files with MSVC.

20 months agounigbrk/u8-grapheme-{next,prev} tests: Fix gcc -Wformat warnings.
Bruno Haible [Tue, 5 Sep 2023 15:32:28 +0000 (17:32 +0200)]
unigbrk/u8-grapheme-{next,prev} tests: Fix gcc -Wformat warnings.

* tests/unigbrk/test-u8-grapheme-next.c (test_u8_grapheme_next): Use
%tu, not %zu, to print a pointer difference.
* tests/unigbrk/test-u16-grapheme-next.c (test_u16_grapheme_next):
Likewise.
* tests/unigbrk/test-u32-grapheme-next.c (test_u32_grapheme_next):
Likewise.
* tests/unigbrk/test-u8-grapheme-prev.c (test_u8_grapheme_prev):
Likewise.
* tests/unigbrk/test-u16-grapheme-prev.c (test_u16_grapheme_prev):
Likewise.
* tests/unigbrk/test-u32-grapheme-prev.c (test_u32_grapheme_prev):
Likewise.

20 months agostdint, *printf: Update doc about MSVC.
Bruno Haible [Tue, 5 Sep 2023 14:36:11 +0000 (16:36 +0200)]
stdint, *printf: Update doc about MSVC.

* doc/posix-headers/stdint.texi: MSVC 14 has <stdint.h>.
* doc/posix-functions/*printf.texi: Current mingw and MSVC 14 support
the j, t, z size specifiers.
* doc/glibc-functions/obstack_*printf.texi: Likewise.

20 months agotests: Ensure stderr output is displayed before abort().
Bruno Haible [Tue, 5 Sep 2023 13:55:24 +0000 (15:55 +0200)]
tests: Ensure stderr output is displayed before abort().

* tests/atomic-int-gnulib.h (init_atomic_int): Call fflush(stderr)
before abort().
* tests/atomic-int-isoc.h (init_atomic_int): Likewise.
* tests/atomic-int-posix.h (init_atomic_int): Likewise.
* tests/unigbrk/test-u8-grapheme-breaks.c (test_u8_grapheme_breaks):
Likewise.
* tests/unigbrk/test-u16-grapheme-breaks.c (test_u16_grapheme_breaks):
Likewise.
* tests/unigbrk/test-u32-grapheme-breaks.c (test_u32_grapheme_breaks):
Likewise.
* tests/unigbrk/test-uc-grapheme-breaks.c (test_uc_grapheme_breaks):
Likewise.
* tests/unigbrk/test-ulc-grapheme-breaks.c (main): Likewise.
* tests/unigbrk/test-u8-grapheme-next.c (test_u8_grapheme_next):
Likewise.
* tests/unigbrk/test-u16-grapheme-next.c (test_u16_grapheme_next):
Likewise.
* tests/unigbrk/test-u32-grapheme-next.c (test_u32_grapheme_next):
Likewise.
* tests/unigbrk/test-u8-grapheme-prev.c (test_u8_grapheme_prev):
Likewise.
* tests/unigbrk/test-u16-grapheme-prev.c (test_u16_grapheme_prev):
Likewise.
* tests/unigbrk/test-u32-grapheme-prev.c (test_u32_grapheme_prev):
Likewise.

20 months agothreads-h: Modernize configure test.
Bruno Haible [Tue, 5 Sep 2023 11:00:38 +0000 (13:00 +0200)]
threads-h: Modernize configure test.

* m4/threads_h.m4 (gl_THREADS_H): In the test program, put the
'_Thread_local' storage class specifier before the type.

20 months agoAdd info about recommended warning options.
Bruno Haible [Tue, 5 Sep 2023 10:36:03 +0000 (12:36 +0200)]
Add info about recommended warning options.

* HACKING: New section "Warning Options".

20 months agostring-buffer tests: Fix a compilation error (regression from today).
Bruno Haible [Tue, 5 Sep 2023 02:01:22 +0000 (04:01 +0200)]
string-buffer tests: Fix a compilation error (regression from today).

* tests/test-string-buffer.c: Include <wchar.h>.

20 months agounistr/u{8,16,32}-strtok tests: Fix -Wanalyzer-allocation-size warnings.
Bruno Haible [Tue, 5 Sep 2023 01:06:30 +0000 (03:06 +0200)]
unistr/u{8,16,32}-strtok tests: Fix -Wanalyzer-allocation-size warnings.

* tests/unistr/test-u-strtok.h (test_u_strtok): Correct values of
input_len and delim_len.

20 months agosigpipe tests: Fix -Wanalyzer-unsafe-call-within-signal-handler warning.
Bruno Haible [Mon, 4 Sep 2023 22:58:37 +0000 (00:58 +0200)]
sigpipe tests: Fix -Wanalyzer-unsafe-call-within-signal-handler warning.

* tests/test-sigpipe.c (handler): Invoke _exit, not exit.
* tests/test-raise.c (handler): Update comments after 2020-11-25 change.

20 months agoargp: Distinguish NULL and '\0' from 0.
Bruno Haible [Mon, 4 Sep 2023 22:44:01 +0000 (00:44 +0200)]
argp: Distinguish NULL and '\0' from 0.

* lib/argp-pin.c: Include <stddef.h>.
(program_invocation_short_name, program_invocation_name): Use NULL
instead of 0.
* lib/argp-parse.c (convert_options, __argp_parse, __argp_input):
Likewise.
* lib/argp-fmtstream.c (__argp_make_fmtstream): Likewise.
* lib/argp-help.c (make_hol, hol_entry_first_long, hol_find_entry,
hol_append, hol_entry_help, argp_doc, _help): Likewise.
(hol_usage): Use '\0' instead of 0.

20 months agoargp: Fix gcc -Wanalyzer-use-of-uninitialized-value warning.
Bruno Haible [Mon, 4 Sep 2023 22:22:30 +0000 (00:22 +0200)]
argp: Fix gcc -Wanalyzer-use-of-uninitialized-value warning.

* lib/argp-help.c (hol_find_entry): Access hol->entries only after
having verified that hol->num_entries > 0.

20 months agounictype/category-byname tests: Fix gcc -Wunused-value warning.
Bruno Haible [Mon, 4 Sep 2023 22:04:29 +0000 (00:04 +0200)]
unictype/category-byname tests: Fix gcc -Wunused-value warning.

* tests/unictype/test-categ_byname.c (main): Add some tests for category
Nl.

20 months agounigbrk/uc-grapheme-breaks tests: Fix gcc -Wunused-function warning.
Bruno Haible [Mon, 4 Sep 2023 21:38:34 +0000 (23:38 +0200)]
unigbrk/uc-grapheme-breaks tests: Fix gcc -Wunused-function warning.

* tests/unigbrk/test-uc-grapheme-breaks.c
(graphemebreakproperty_to_string): Mark as possibly unused.

20 months agobitset, nonblocking-* tests: Fix gcc -Wunused-but-set-variable warnings.
Bruno Haible [Mon, 4 Sep 2023 21:32:22 +0000 (23:32 +0200)]
bitset, nonblocking-* tests: Fix gcc -Wunused-but-set-variable warnings.

* tests/test-bitset.c (check_zero): Mark 'i' as possibly unused.
* tests/test-nonblocking-reader.h (full_read): Mark 'spent_time' as
possibly unused.

20 months agoUse statement-expressions without warnings, even in strict ISO C mode.
Bruno Haible [Mon, 4 Sep 2023 19:54:09 +0000 (21:54 +0200)]
Use statement-expressions without warnings, even in strict ISO C mode.

Suggested by Eric Blake <eblake@redhat.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2023-09/msg00025.html>.

* lib/error.in.h (__gl_error_call): Use the variant with obvious control
flow also with clang. Use '__extension__' to avoid -Wpedantic warnings.
* lib/math.in.h (gl_signbitf, gl_signbitd, gl_signbitl): Define as
macros even when __STRICT_ANSI__ is defined. But use '__extension__' to
avoid -Wpedantic warnings.
* lib/setenv.c (KNOWN_VALUE): Use '__extension__' to avoid -Wpedantic
warnings.
* lib/xalloc-oversized.h (xalloc_oversized): Use optimized variant even
when __STRICT_ANSI__ is defined. But use '__extension__' to avoid
-Wpedantic warnings.

20 months agoFix some g++ warnings "has a different exception specifier".
Bruno Haible [Mon, 4 Sep 2023 17:22:21 +0000 (19:22 +0200)]
Fix some g++ warnings "has a different exception specifier".

* m4/gnulib-common.m4 (gl_COMMON_BODY): Make _GL_ATTRIBUTE_NOTHROW
effective in C++ mode.
* lib/attribute.h (ATTRIBUTE_NOTHROW): Add a comment.
* lib/malloc.in.h (_GL_ATTRIBUTE_NOTHROW): Provide fallback definition.
(memalign): Invoke _GL_FUNCDECL_SYS with _GL_ATTRIBUTE_NOTHROW.
* lib/stdio.in.h (_GL_ATTRIBUTE_NOTHROW): Provide fallback definition.
(fdopen): Invoke _GL_FUNCDECL_SYS with _GL_ATTRIBUTE_NOTHROW.
* lib/stdlib.in.h (_GL_ATTRIBUTE_NOTHROW): Provide fallback definition.
(aligned_alloc, calloc, canonicalize_file_name, malloc, realloc): Invoke
_GL_FUNCDECL_SYS with _GL_ATTRIBUTE_NOTHROW.
* lib/string.in.h (_GL_ATTRIBUTE_NOTHROW): Provide fallback definition.
(strdup, strndup): Invoke _GL_FUNCDECL_SYS with _GL_ATTRIBUTE_NOTHROW.
* lib/sys_stat.in.h (_GL_ATTRIBUTE_NOTHROW): Provide fallback
definition.
(getumask): Invoke _GL_FUNCDECL_SYS with _GL_ATTRIBUTE_NOTHROW.
* lib/wchar.in.h (_GL_ATTRIBUTE_NOTHROW): Provide fallback definition.
(wcsdup): Invoke _GL_FUNCDECL_SYS with _GL_ATTRIBUTE_NOTHROW.

20 months agounistr/u{8,16,32}-strchr tests: Fix some gcc -Wshadow warnings.
Bruno Haible [Mon, 4 Sep 2023 15:43:50 +0000 (17:43 +0200)]
unistr/u{8,16,32}-strchr tests: Fix some gcc -Wshadow warnings.

* tests/unistr/test-strchr.h (test_strchr): Reduce of scope of local
variable 'i'.

20 months agounistr/u{8,16,32}-chr tests: Fix some gcc -Wshadow warnings.
Bruno Haible [Mon, 4 Sep 2023 15:35:29 +0000 (17:35 +0200)]
unistr/u{8,16,32}-chr tests: Fix some gcc -Wshadow warnings.

* tests/unistr/test-chr.h (main): Reduce of scope of local variables
'i' and 'page_boundary'.

20 months agopipe-filter-gi, pipe-filter-ii tests: Fix some gcc -Wshadow warnings.
Bruno Haible [Mon, 4 Sep 2023 15:24:35 +0000 (17:24 +0200)]
pipe-filter-gi, pipe-filter-ii tests: Fix some gcc -Wshadow warnings.

* tests/test-pipe-filter-gi1.c (main): Rename local variable 'argv' to
'tr_argv'.
* tests/test-pipe-filter-ii1.c (main): Likewise.

20 months agoargv-iter tests: Avoid gcc -Wanalyzer-out-of-bounds warning.
Bruno Haible [Mon, 4 Sep 2023 15:07:33 +0000 (17:07 +0200)]
argv-iter tests: Avoid gcc -Wanalyzer-out-of-bounds warning.

* tests/test-argv-iter.c (main): Simplify logic.

20 months agocrypto/{gc-rijndael,rijndael} tests: Fix some gcc -Wshadow warnings.
Bruno Haible [Mon, 4 Sep 2023 14:48:41 +0000 (16:48 +0200)]
crypto/{gc-rijndael,rijndael} tests: Fix some gcc -Wshadow warnings.

* tests/test-gc-rijndael.c (main): Rename local variable 'i' to 'round'.
* tests/test-rijndael.c (main): Likewise.

20 months agothreads-h tests: Fix gcc -Wold-style-declaration warning.
Bruno Haible [Mon, 4 Sep 2023 14:39:07 +0000 (16:39 +0200)]
threads-h tests: Fix gcc -Wold-style-declaration warning.

* tests/test-thread_local.c (value0, value1, value2, value3): Put the
'thread_local' storage class specifier before the type.

20 months agoieee754-h tests: Fix some gcc -Wmissing-field-initializers warnings.
Bruno Haible [Mon, 4 Sep 2023 14:23:39 +0000 (16:23 +0200)]
ieee754-h tests: Fix some gcc -Wmissing-field-initializers warnings.

* tests/test-ieee754-h.c (float_tests): Use float literals.
(double_tests): Use double literals. Initialize frac_lo.

20 months agostring-buffer tests: Fix a gcc -Wformat warning.
Bruno Haible [Mon, 4 Sep 2023 14:02:36 +0000 (16:02 +0200)]
string-buffer tests: Fix a gcc -Wformat warning.

* tests/test-string-buffer.c: Don't assume that wint_t has the same size
as 'int'.

20 months agocrypto/* tests: Fix some gcc -Wdiscarded-qualifiers warnings.
Bruno Haible [Mon, 4 Sep 2023 13:46:39 +0000 (15:46 +0200)]
crypto/* tests: Fix some gcc -Wdiscarded-qualifiers warnings.

* tests/test-gc-hmac-md5.c (main): Change type of variables with a
string literal initializer to 'const char *'.
* tests/test-gc-hmac-sha1.c (main): Likewise.
* tests/test-gc-hmac-sha256.c (main): Likewise.
* tests/test-gc-hmac-sha512.c (main): Likewise.
* tests/test-gc-md2.c (main): Likewise.
* tests/test-gc-md5.c (main): Likewise.
* tests/test-gc-sha1.c (main): Likewise.
* tests/test-gc-sha256.c (main): Likewise.
* tests/test-gc-sha512.c (main): Likewise.
* tests/test-hmac-md5.c (main): Likewise.
* tests/test-hmac-sha1.c (main): Likewise.
* tests/test-hmac-sha256.c (main): Likewise.
* tests/test-hmac-sha512.c (main): Likewise.

20 months agofile-has-acl: Avoid gcc warning.
Bruno Haible [Mon, 4 Sep 2023 13:20:59 +0000 (15:20 +0200)]
file-has-acl: Avoid gcc warning.

* lib/acl-internal.h (MIN): Remove definition.

20 months agosame-inode, stat-size: support pointers too
Paul Eggert [Mon, 4 Sep 2023 01:14:53 +0000 (18:14 -0700)]
same-inode, stat-size: support pointers too

Add functions and macros so that we can test pointers to struct
stat as well as plain struct stat.  This lets coreutils deal with
structs that are only partly initialized, without relying on
undefined behavior.
* NEWS: Mention this.
* doc/posix-headers/sys_stat.texi, doc/stat-size.texi:
Mention this and modernize.
* lib/at-func2.c (at_func2):
* lib/fts.c (same_fd):
* lib/rename.c (rpl_rename) [RENAME_HARD_LINK_BUG]:
* lib/same-inode.c: New file.
* lib/same.c (same_nameat):
* lib/term-style-control.c (activate_term_style_controller):
Prefer psame_inode (a, b) to SAME_INODE (*a, *b).
* lib/hash-triple-simple.c (triple_compare_ino_str):
* lib/hash-triple.c (triple_compare):
Prefer PSAME_INODE (a, b) to SAME_INODE (*a, *b).
psame_inode is not suitable since the args are not struct stat *.
* lib/same-inode.h: Check that config.h is included first.
(SAME_INODE_INLINE, PSAME_INODE): New macros.
(SAME_INODE): Reimplement in terms of PSAME_INODE.
(psame_inode): New function.
* lib/stat-size.h (STP_BLKSIZE, STP_NBLOCKS): New macros.
(ST_BLKSIZE, ST_NBLOCKS): Use them.
* lib/term-style-control.c (log_signal_handler_called):
Always define as a function, to pacify -Wunused*.
* modules/canonicalize-lgpl-tests (Files): Add m4/musl.m4.
(Depends-on): Call gl_MUSL_LIBC.
* modules/same-inode (Files): Add same-inode.c.
(Depends-on): Add extern-inline, stdbool.
(lib_SOURCES): New macro.
* tests/test-binary-io.c, tests/test-canonicalize-lgpl.c:
* tests/test-canonicalize.c, tests/test-cloexec.c:
* tests/test-dup-safer.c, tests/test-dup2.c, tests/test-error.c:
* tests/test-fcntl.c, tests/test-fdopendir.c, tests/test-fgetc.c:
* tests/test-fputc.c, tests/test-fread.c, tests/test-fstat.c:
* tests/test-fstatat.c, tests/test-ftruncate.c:
* tests/test-fwrite.c, tests/test-getcwd.c:
* tests/test-getdtablesize.c, tests/test-isblank.c:
* tests/test-linkat.c, tests/test-lock.c, tests/test-lstat.h:
* tests/test-malloc-gnu.c, tests/test-openat.c:
* tests/test-pthread-thread.c, tests/test-pthread_sigmask1.c:
* tests/test-pthread_sigmask2.c, tests/test-ptsname.c:
* tests/test-ptsname_r.c, tests/test-raise.c:
* tests/test-realloc-gnu.c, tests/test-rwlock1.c:
* tests/test-sigprocmask.c, tests/test-snprintf.c:
* tests/test-stat.h, tests/test-term-style-control-hello.c:
* tests/test-term-style-control-yes.c, tests/test-thread_create.c:
* tests/test-unlinkat.c, tests/test-vasnprintf.c:
* tests/test-xalloc-die.c:
Adjust to these changes, and fix some warnings elicited by
-Wall -Wextra that I ran into while testing.
* top/maint.mk (sc_prohibit_stat_st_blocks): Mention STP_NBLOCKS.