Paul Eggert [Mon, 28 Apr 2025 06:49:12 +0000 (23:49 -0700)]
threadlib: make m4 work better with Emacs
* m4/threadlib.m4: Refactor by prefering AS_CASE to case, " to ',
$(...) to `, [[...]] to changequote, and #-to-newline to #-with-].
That way, Emacs commands recognize the sexps here.
Omit some unnecessary quotes.
Paul Eggert [Mon, 28 Apr 2025 06:49:12 +0000 (23:49 -0700)]
manywarnings: omit -Wdisabled-optimization
* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
Remove -Wdisabled-optimization, as this is a warning about the
compiler not the program. I discovered the need for this when
compiling bleeding-edge Emacs with gcc-15 (Ubuntu
15-20250404-0ubuntu1) 15.0.1 20250404 (experimental) [master r15-9193-g08e803aa9be] on x86-64. Also, omit a
no-longer-necessary LC_ALL=C in a comment.
Bruno Haible [Sun, 27 Apr 2025 21:36:52 +0000 (23:36 +0200)]
Make use of gcc's __nonnull_if_nonzero__ attribute.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Define
_GL_ATTR_nonnull_if_nonzero and _GL_ATTRIBUTE_NONNULL_IF_NONZERO.
* lib/attribute.h (ATTRIBUTE_NONNULL_IF_NONZERO): new macro.
* lib/stdlib.in.h (_GL_ATTRIBUTE_NONNULL_IF_NONZERO): New macro.
(bsearch, qsort, qsort_r): Use it.
* lib/string.in.h (_GL_ATTRIBUTE_NONNULL_IF_NONZERO): New macro.
(memcpy, memccpy, memmove, strncpy, strndup, strncat, memcmp, strncmp,
memchr, memrchr, memset, memset_explicit): Use it.
* lib/wchar.in.h (_GL_ATTRIBUTE_NONNULL_IF_NONZERO): New macro.
(wmemcpy, wmemmove, wcsncpy, wcsncat, wmemcmp, wcsncmp, wmemchr,
wmemset): Use it.
* lib/string-desc.h (sd_new_addr): Use it.
Paul Eggert [Mon, 21 Apr 2025 17:58:58 +0000 (10:58 -0700)]
getloadavg: port to Android 3.1-
Problem reported by Po Lu in:
https://lists.gnu.org/r/bug-gnulib/2025-04/msg00172.html
* lib/getloadavg.c (getloadavg): Do not try to use sysinfo on
Android 3.1 Honeycomb (API 12, 2011) and earlier.
Bruno Haible [Fri, 18 Apr 2025 17:47:03 +0000 (19:47 +0200)]
Pacify gcc -Wtrailing-whitespace warnings across all of config.h.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Use AH_TOP and AH_BOTTOM to
disable -Wtrailing-whitespace warnings across all of config.h.
* m4/iconv.m4: Revert last change.
Bruno Haible [Fri, 18 Apr 2025 13:41:59 +0000 (15:41 +0200)]
unitypes-h: Avoid risky coding pattern.
* m4/unitypes_h.m4: New file, based on modules/unitypes-h.
* modules/unitypes-h (Files): Add it.
(configure.ac): Invoke gl_UNITYPES_H. Remove AH_VERBATIM invocation.
Bruno Haible [Fri, 18 Apr 2025 13:05:10 +0000 (15:05 +0200)]
getlogin_r tests: Remove xalloc dependency.
* tests/test-getlogin.c (main): Don't assume the putenv argument is
unmodified.
* tests/test-getlogin_r.c: Do not include xalloc.h.
(main): Use a static rather than heap storage.
* modules/getlogin_r-tests (Depends-on): Remove xalloc.
(test_getlogin_LDADD): Remove @LIBINTL@.
Paul Eggert [Thu, 17 Apr 2025 07:24:27 +0000 (00:24 -0700)]
getlogin-tests: remove xalloc dependency
* modules/getlogin-tests (Depends-on): Remove xalloc.
(test_getlogin_LDADD): Remove @LIBINTL@.
* tests/test-getlogin.c: Do not include xalloc.h.
(main): Use a static rather than heap storage.
Paul Eggert [Thu, 17 Apr 2025 07:22:43 +0000 (00:22 -0700)]
Pacify GCC 15’s new -Wtrailing-whitespace option
* m4/builtin-expect.m4 (gl___BUILTIN_EXPECT):
* m4/iconv.m4 (AM_ICONV_LINK, AM_ICONV):
Avoid whitespace at line end in C code.
* modules/unitypes-h (unitypes_restrict):
Likewise, bearing in mind that configure.ac lines will be indented
so such lines containing only '])' should be avoided when they
generate C code.
Paul Eggert [Thu, 17 Apr 2025 07:13:49 +0000 (00:13 -0700)]
manywarnings: update C warnings for GCC 15
Adjust for C programs compiled by GCC 15.
This is merely changes to commentary; no changes to
the flags passed to GCC.
* build-aux/gcc-warning.spec: Add warnings introduced in GCC 15.
Sort for LC_ALL=C, so that the update procedure is reproducible.
* m4/manywarnings.m4: Specify LC_ALL=C in comment.
Bruno Haible [Wed, 16 Apr 2025 22:09:05 +0000 (00:09 +0200)]
getopt-posix: Avoid trouble due to 'struct rpl_option'.
* lib/getopt.in.h: Arrange for the system's <getopt.h> to define
'struct sys_option' instead of 'struct option'.
* lib/getopt-pfx-ext.h (option): Don't rename to rpl_option.
Paul Eggert [Mon, 14 Apr 2025 22:42:40 +0000 (15:42 -0700)]
regex: remove _REGEX_NELTS
This is a cleanup after the recent fix for undefined behavior.
* lib/regex.h (_REGEX_NELTS): Remove, as it is no longer useful.
All uses removed. Remove no-longer-needed uses of #pragma GCC.
Paul Eggert [Mon, 14 Apr 2025 01:01:08 +0000 (18:01 -0700)]
regex: match current Emacs behavior
* config/srclist.txt: Comment out regex.h, since we now
disagree with glibc.
* lib/regex.h (RE_SYNTAX_EMACS):
Match Emacs 21+ behavior, not Emacs 20-.
* m4/regex.m4 (gl_REGEX): Check for this Emacs fix.
Bruno Haible [Sun, 13 Apr 2025 21:18:10 +0000 (23:18 +0200)]
getlogin_r tests: Avoid writing to a literal string.
* tests/test-getlogin_r.c: Include xalloc.h.
(main): Pass a writable string to putenv().
* modules/getlogin_r-tests (Depends-on): Add xalloc.
(Makefile.am): Link the program with libintl when needed.
Bruno Haible [Sun, 13 Apr 2025 21:17:06 +0000 (23:17 +0200)]
getlogin tests: Avoid writing to a literal string.
* tests/test-getlogin.c: Include xalloc.h.
(main): Pass a writable string to putenv().
* modules/getlogin-tests (Depends-on): Add xalloc.
(Makefile.am): Link the program with libintl when needed.
Bruno Haible [Sun, 13 Apr 2025 15:48:56 +0000 (17:48 +0200)]
vasnprintf tests: Fix compilation error on MSVC (regression yesterday).
* tests/test-vasnprintf-posix2.c (main): Disable the new test on
platforms where the 'long double' value range is insufficient.
* tests/test-vasnwprintf-posix2.c (main): Likewise.
aligned-malloc tests: Simplify a macro definition and improve comment.
Suggested by Bruno Haible.
* tests/test-aligned-malloc.c (ALIGNMENT): Undefine without checking.
Mention that the #undef is for AIX which defines it beforehand in
<sys/socket.h>.
Bruno Haible [Sat, 12 Apr 2025 07:32:43 +0000 (09:32 +0200)]
localeconv tests: Add multithread-safety test.
* tests/test-localeconv-mt.c: New file, based on
tests/test-nl_langinfo-mt.c.
* modules/localeconv-tests (Files): Add it.
(Depends-on): Add setlocale, thread, nanosleep.
(Makefile.am): Arrange to compile and run test-localeconv-mt.
Bruno Haible [Fri, 11 Apr 2025 14:59:24 +0000 (16:59 +0200)]
vasnprintf: Follow glibc's behaviour on glibc systems.
* lib/vasnprintf.c (DCHAR_MBSNLEN): Define fallback.
(VASNPRINTF): Use it on for width handling on glibc.
* modules/vasnprintf (Depends-on): Add mbsnlen.
* modules/c-vasnprintf (Depends-on): Likewise.
Paul Eggert [Mon, 7 Apr 2025 08:45:17 +0000 (01:45 -0700)]
file-has-acl: port symlink code to Cygwin
Problem reported by Corinna Vinschen in:
https://lists.gnu.org/r/bug-gnulib/2025-03/msg00112.html
* lib/file-has-acl.c (acl_get_link_np): New static function,
defined only if needed; include <fcntl.h> if needed for this.
(HAVE_ACL_GET_LINK_NP): Define this if defining acl_get_link_np.
* lib/stdio-impl.h (fp_) [__HAIKU__]: Define to FILE which is an
incomplete type on Haiku.
(_IO_EOF_SEEN) [__HAIKU__]: Define macro.
* lib/fseeko.c (fp_) [!__HAIKU__]: Define to fp.
(fseeko): Use fp_ instead of fp.
Bruno Haible [Wed, 2 Apr 2025 22:45:30 +0000 (00:45 +0200)]
Silence some -Wunterminated-string-initialization warnings.
* lib/base32.c (base32_encode): Mark b32str as not NUL-terminated.
* lib/base64.c (b64c): Mark as not NUL-terminated.
* lib/bcp47.c (struct script): Mark the 'code' field as not
NUL-terminated.
* lib/striconveh.c (mem_cd_iconveh_internal): Mark hex as not
NUL-terminated.
* lib/unicase/special-casing.in.h (struct special_casing_rule): Mark the
'code' field as not NUL-terminated.
Bruno Haible [Mon, 31 Mar 2025 09:30:12 +0000 (11:30 +0200)]
acl, file-has-acl tests: Strengthen tests on Cygwin.
Suggested by Corinna Vinschen in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-03/msg00126.html>.
* tests/test-set-mode-acl.sh: On Cygwin, use group 1 instead of the
non-existent group 0.
* tests/test-copy-acl.sh: Likewise.
* tests/test-file-has-acl.sh: Likewise.
* top/bootstrap-funclib.sh (autogen): Don't pass unnecessary -I's when
invoking autoreconf. The order of M4 include directories is reflected
in Makefile.in content. Our GNUmakefile _version rule invoke
autoreconf without any extra -I, and this difference in how autoreconf
is invoked results in different tarballs for "make dist" vs "make
release" which is undesirable.