Collin Funk [Sat, 3 May 2025 03:33:56 +0000 (20:33 -0700)]
doc: Update documentation for 'open' errno discrepancies.
* doc/posix-functions/open.texi: Document that NetBSD 10.0 and FreeBSD
14.2 set errno differently than POSIX specifies for
'open ("symlink", O_NOFOLLOW ...)'.
Bruno Haible [Fri, 2 May 2025 10:09:40 +0000 (12:09 +0200)]
vc-mtime: Make it work with git versions < 2.28.
* lib/vc-mtime.c (git_version): New variable.
(is_git_present): Read the output of "git --version", and set
git_version.
(max_vc_mtime): Don't pass option --no-relative if the git version
is < 2.28.
Bruno Haible [Wed, 30 Apr 2025 09:57:34 +0000 (11:57 +0200)]
obstack: Make it easier to sync back with glibc.
* lib/obstack.in.h: Use __GL_GNULIB_HEADER to delimit sections that are
for Gnulib usage.
Test __GL_SMALL_PTRDIFF_T__ instead of @SMALL_PTRDIFF_T@.
Test __GL_REPLACE_OBSTACK__ instead of @REPLACE_OBSTACK@.
* modules/obstack (Makefile.am): Substitute __GL_GNULIB_HEADER.
Substitute __GL_SMALL_PTRDIFF_T__ instead of @SMALL_PTRDIFF_T@.
Substitute __GL_REPLACE_OBSTACK__ instead of @REPLACE_OBSTACK@.
Bruno Haible [Wed, 30 Apr 2025 01:19:10 +0000 (03:19 +0200)]
New module mem-hash-map.
* lib/mem-hash-map.h: New file, from GNU gettext.
* lib/mem-hash-map.c: New file, from GNU gettext.
* modules/mem-hash-map: New file, from GNU gettext.
Bruno Haible [Tue, 29 Apr 2025 23:52:17 +0000 (01:52 +0200)]
New module next-prime.
* lib/next-prime.h: New file, based on lib/hash.c.
* lib/next-prime.c: New file, based on lib/hash.c.
* modules/next-prime: New file.
* lib/hash.c: Include next-prime.h.
(is_prime, next_prime): Remove functions.
* modules/hash (Depends-on): Add next-prime.
Bruno Haible [Tue, 29 Apr 2025 23:20:17 +0000 (01:20 +0200)]
New module hashkey-string.
* lib/hashkey-string.h: New file.
* lib/hashkey-string.c: New file, based on lib/clean-temp-simple.c.
* modules/hashkey-string: New file.
* lib/clean-temp-simple.c: Include hashkey-string.h. Don't include
<limits.h>.
(clean_temp_string_equals, clean_temp_string_hash): Remove functions.
(SIZE_BITS): Remove macro.
(register_temporary_file): Use hashkey_string_equals and
hashkey_string_hash.
* modules/clean-temp-simple (Depends-on): Add hashkey-string.
* m4/threadlib.m4: When conditionally invoking a macro that uses
or might use AC_REQUIRE, put it inside AS_CASE or AS_IF instead
of using shell constructs directly.
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.