Bruno Haible [Sat, 15 Jun 2024 01:51:50 +0000 (03:51 +0200)]
doc: Update for glibc 2.35.
* doc/glibc-functions/_dl_find_object.texi: New file.
* doc/glibc-functions/epoll_pwait2.texi: New file.
* doc/glibc-functions/posix_spawn_file_actions_addtcsetpgrp_np.texi: New
file.
* doc/posix-functions/dfmal.texi: New file.
* doc/posix-functions/dsqrtl.texi: New file.
* doc/posix-functions/ffma.texi: New file.
* doc/posix-functions/ffmal.texi: New file.
* doc/posix-functions/fmaximum.texi: New file.
* doc/posix-functions/fmaximum_mag.texi: New file.
* doc/posix-functions/fmaximum_mag_num.texi: New file.
* doc/posix-functions/fmaximum_mag_numf.texi: New file.
* doc/posix-functions/fmaximum_mag_numl.texi: New file.
* doc/posix-functions/fmaximum_magf.texi: New file.
* doc/posix-functions/fmaximum_magl.texi: New file.
* doc/posix-functions/fmaximum_num.texi: New file.
* doc/posix-functions/fmaximum_numf.texi: New file.
* doc/posix-functions/fmaximum_numl.texi: New file.
* doc/posix-functions/fmaximumf.texi: New file.
* doc/posix-functions/fmaximuml.texi: New file.
* doc/posix-functions/fminimum.texi: New file.
* doc/posix-functions/fminimum_mag.texi: New file.
* doc/posix-functions/fminimum_mag_num.texi: New file.
* doc/posix-functions/fminimum_mag_numf.texi: New file.
* doc/posix-functions/fminimum_mag_numl.texi: New file.
* doc/posix-functions/fminimum_magf.texi: New file.
* doc/posix-functions/fminimum_magl.texi: New file.
* doc/posix-functions/fminimum_num.texi: New file.
* doc/posix-functions/fminimum_numf.texi: New file.
* doc/posix-functions/fminimum_numl.texi: New file.
* doc/posix-functions/fminimumf.texi: New file.
* doc/posix-functions/fminimuml.texi: New file.
* doc/posix-functions/fsqrt.texi: New file.
* doc/posix-functions/fsqrtl.texi: New file.
* doc/gnulib.texi: Include them.
Bruno Haible [Sat, 15 Jun 2024 00:23:01 +0000 (02:23 +0200)]
doc: More updates for glibc 2.34.
* doc/glibc-functions/ns_name_compress.texi: New file.
* doc/glibc-functions/ns_name_ntop.texi: New file.
* doc/glibc-functions/ns_name_pack.texi: New file.
* doc/glibc-functions/ns_name_pton.texi: New file.
* doc/glibc-functions/ns_name_skip.texi: New file.
* doc/glibc-functions/ns_name_uncompress.texi: New file.
* doc/glibc-functions/ns_name_unpack.texi: New file.
* doc/gnulib.texi (Glibc arpa/nameser.h): New section.
Paul Eggert [Fri, 14 Jun 2024 21:29:18 +0000 (14:29 -0700)]
xsize: port to SIZE_MAX <= INT_MAX
* lib/xsize.h (xsum): Port to oddball platforms where SIZE_MAX <=
INT_MAX. Although no such platform is a current Gnulib porting
problems, it’s easy enough to port to them.
Paul Eggert [Fri, 14 Jun 2024 17:58:24 +0000 (10:58 -0700)]
sigsegv-tests: port to plain POSIX
* tests/test-sigsegv-catch-segv1.c, tests/test-sigsegv-catch-segv2.c:
(SIGSEGV_FAULT_ADDRESS_ROUNDOFF_BITS):
Use sysconf (_SC_PAGESIZE) instead of getpagesize, as this code is
compiled only on platforms that have _SC_PAGESIZE and POSIX
prefers the latter.
Paul Eggert [Fri, 14 Jun 2024 17:54:36 +0000 (10:54 -0700)]
free-posix-tests: port to plain POSIX
* tests/test-free.c (main): Use sysconf (_SC_PAGESIZE) instead of
getpagesize, as this code is compiled only on platforms that have
_SC_PAGESIZE and POSIX prefers the latter.
Paul Eggert [Fri, 14 Jun 2024 17:47:06 +0000 (10:47 -0700)]
mprotect: don’t assume pointers fit in long
* m4/mprotect.m4 (gl_FUNC_MPROTECT_WORKS): Don’t assume pointers
fit into unsigned long, as this is not true on CheriBSD. Prefer
sysconf (_SC_PAGESIZE) to getpagesize.
Paul Eggert [Fri, 14 Jun 2024 17:42:40 +0000 (10:42 -0700)]
memchr,strncat: prefer sysconf (_SC_PAGESIZE)
* m4/memchr.m4 (gl_FUNC_MEMCHR):
* m4/strncat.m4 (gl_FUNC_STRNCAT):
Use sysconf (_SC_PAGESIZE) instead of getpagesize, as it’s
in POSIX and there’s no point to worrying about getpagesize
performance advantages here.
Paul Eggert [Fri, 14 Jun 2024 17:26:30 +0000 (10:26 -0700)]
getcwd: simplify abort bug checking
* m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Don’t invoke
gl_CHECK_FUNC_GETPAGESIZE or #define or use HAVE_GETPAGESIZE.
Protect ‘bug_possible’ with ‘defined _SC_PAGESIZE’ instead.
That’s good enough as the buggy platforms all define _SC_PAGESIZE.
* modules/getcwd (Files): Remove m4/getpagesize.m4.
* tests/test-getcwd.c (getpagsize): Remove replacement macro.
(test_abort_bug): Similar fix for ‘bug_possible’.
Paul Eggert [Tue, 11 Jun 2024 22:09:55 +0000 (15:09 -0700)]
mktempd: use GNU-style -t if available
This better satisfies Jim Meyering’s point in:
https://lists.gnu.org/archive/html/bug-gnulib/2016-03/msg00074.html
that it’s more useful when each temporary test directory name
includes the corresponding test’s name.
* build-aux/mktempd: Try mktemp -t only with GNU syntax, so that
NetBSD mktemp fails. Also, reject templates beginning with "-" so
that they are not treated as options.
* tests/init.sh (mktempd_): Likewise.
* pygnulib/GLImport.py (GLImport.relative_to_destdir)
(GLImport.relative_to_currdir): Use os.path.isabs() instead of checking
for a slash.
* pygnulib/constants.py (symlink_relative, as_link_value_at_dest)
(hardlink): Use os.path.isabs() instead of checking for a slash or drive
prefix.
Bruno Haible [Sun, 9 Jun 2024 17:16:01 +0000 (19:16 +0200)]
c32rtomb: Add a sanity check, working around Solaris 11 OmniOS.
* m4/c32rtomb.m4 (gl_CHECK_FUNC_C32RTOMB): New macro, extracted from
gl_FUNC_C32RTOMB.
(gl_C32RTOMB_SANITYCHECK): New macro.
(gl_FUNC_C32RTOMB): Require gl_CHECK_FUNC_C32RTOMB and
gl_C32RTOMB_SANITYCHECK. If HAVE_WORKING_C32RTOMB is 0, set
REPLACE_C32RTOMB.
* lib/c32rtomb.c (c32rtomb): Together with HAVE_WORKING_MBRTOC32, test
also HAVE_WORKING_C32RTOMB.
* m4/mbrtoc32.m4 (gl_PREREQ_MBRTOC32): Require gl_C32RTOMB_SANITYCHECK.
* lib/mbrtoc32.c (mbrtoc32): Together with HAVE_WORKING_MBRTOC32, test
also HAVE_WORKING_C32RTOMB.
* modules/mbrtoc32 (Files): Add m4/c32rtomb.m4.
* lib/btoc32.c (btoc32): Together with HAVE_WORKING_MBRTOC32, test also
HAVE_WORKING_C32RTOMB.
* lib/mbsrtoc32s.c: Together with HAVE_WORKING_MBRTOC32, test also
HAVE_WORKING_C32RTOMB.
* lib/mbsnrtoc32s.c: Together with HAVE_WORKING_MBRTOC32, test also
HAVE_WORKING_C32RTOMB.
* lib/c32tob.c (c32tob): Together with HAVE_WORKING_MBRTOC32, test also
HAVE_WORKING_C32RTOMB.
* modules/c32tob (Files): Add m4/c32rtomb.m4.
(configure.ac): Require gl_C32RTOMB_SANITYCHECK.
* lib/c32srtombs.c: Together with HAVE_WORKING_MBRTOC32, test also
HAVE_WORKING_C32RTOMB.
* lib/c32snrtombs.c: Together with HAVE_WORKING_MBRTOC32, test also
HAVE_WORKING_C32RTOMB.
* lib/c32to-impl.h (FUNC): Together with HAVE_WORKING_MBRTOC32, test
also HAVE_WORKING_C32RTOMB.
* modules/c32tolower (Files): Add m4/c32rtomb.m4.
(configure.ac): Require gl_C32RTOMB_SANITYCHECK.
* modules/c32toupper (Files): Add m4/c32rtomb.m4.
(configure.ac): Require gl_C32RTOMB_SANITYCHECK.
* lib/c32width.c (c32width): Together with HAVE_WORKING_MBRTOC32, test
also HAVE_WORKING_C32RTOMB.
* modules/c32width (Files): Add m4/c32rtomb.m4.
(configure.ac): Require gl_C32RTOMB_SANITYCHECK.
Paul Eggert [Thu, 6 Jun 2024 19:54:21 +0000 (12:54 -0700)]
tzname: document some limitations
Unfortunately tzname is a vestigial interface that doesn't work
<https://data.iana.org/time-zones/theory.html#vestigial>.
It's relatively useless in portable code and is planned to be removed
from POSIX <https://austingroupbugs.net/view.php?id=1816>.
Document this better here.
Bruno Haible [Thu, 6 Jun 2024 10:14:46 +0000 (12:14 +0200)]
tzname, daylight, timezone: Update documentation.
* doc/posix-functions/tzname.texi: Update info about native Windows.
* doc/posix-functions/daylight.texi: Update info about OpenBSD, Cygwin,
native Windows.
* doc/posix-functions/timezone.texi: Update info about FreeBSD, OpenBSD,
native Windows.
* pygnulib/GLImport.py (GLImport.execute): Use re.search() instead of
re.findall() since we only care about finding one match. Remove
unnecessary bool() calls.
Bruno Haible [Thu, 6 Jun 2024 00:33:41 +0000 (02:33 +0200)]
setenv: On native Windows, don't modify _environ directly.
* m4/setenv.m4 (gl_PREREQ_SETENV): Check for _putenv.
* lib/setenv.c: On native Windows, include <windows.h> and define
SetEnvironmentVariable.
(setenv) [HAVE_DECL__PUTENV]: New implementation for platforms with
_putenv.
* modules/setenv (Depends-on): Add malloc-posix.
Paul Eggert [Wed, 5 Jun 2024 15:27:55 +0000 (08:27 -0700)]
nstrftime: don’t assume <locale.h>
* lib/strftime.c: Include <locale.h> only if needed, since Emacs
attempts to be portable to platforms lacking <locale.h> so it
avoids localename-unsafe-limited and defines
REQUIRE_GNUISH_STRFTIME_AM_PM to false.
Bruno Haible [Wed, 5 Jun 2024 14:32:02 +0000 (16:32 +0200)]
nstrftime: Make %c work on native Windows again.
* lib/strftime.c: Include <locale.h> always. Include <wchar.h> on native
Windows.
(__strftime_internal): On native Windows, inspect the locale name like
hard_locale would do.
* modules/nstrftime (Link): Remove section.
* tests/test-nstrftime.h (locales_test): Disallow alternative that is
not culturally acceptable for French.
Paul Eggert [Tue, 4 Jun 2024 18:50:07 +0000 (11:50 -0700)]
endian: port better to Android NDK r26
* lib/endian.in.h (be16toh, be32toh, be64toh, htobe16, htobe32)
(htobe64, le16toh, le32toh, le64toh, htole16, htole32, htole64):
When @HAVE_ENDIAN_H@, define each NAME to rpl_NAME so that they
don’t interact incorrectly with system-defined implementations.
Problem reported by Po Lu for Android NDK r26 in:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00040.html
and this patch is an updated version of Collin Funk’s patch in:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00041.html
Collin Funk [Tue, 4 Jun 2024 18:21:04 +0000 (11:21 -0700)]
boot-time, readutmp: Fix missing MinGW include (regr. 2024-05-24).
Reported by Eli Zaretskii in:
<https://lists.gnu.org/archive/html/bug-gnulib/2024-06/msg00044.html>.
* lib/boot-time.c [_WIN32 && !__CYGWIN__]: Remove unnecessary
<sysinfoapi.h> include. Some systems do not have this header and
<windows.h> should have the correct declarations.
* lib/readutmp.c [_WIN32 && !__CYGWIN__]: Likewise.
Paul Eggert [Tue, 4 Jun 2024 05:00:59 +0000 (22:00 -0700)]
nstrftime: remove dependency on hard-locale
GNU Emacs would rather keep dependencies to a minimum,
and hard-locale brings in some other stuff.
* lib/strftime.c: Include locale.h only if (USE_C_LOCALE &&
HAVE_STRFTIME_L) || ((defined __NetBSD__ || defined __sun) &&
REQUIRE_GNUISH_STRFTIME_AM_PM). Do not include hard-locale.h.
(libc_hidden_def): On native MS-Windows, use the C locale %c
format regardless of language. I hope that’s good enough.
If not, let’s try to think of a way of solving the problem
that doesn’t require using hard_locale.
* modules/nstrftime (Depends-on): Remove hard-locale.
* modules/nstrftime-tests (test_nstrftime_LDADD):
Remove $(HARD_LOCALE_LIB).
* tests/test-nstrftime.h (locales_test):
Add a test that I hope works on French MS-Windows.
Paul Eggert [Tue, 4 Jun 2024 05:00:58 +0000 (22:00 -0700)]
ieee754-h: port to Android NDK r26
Problem reported by Po Lu in:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00015.html
* lib/ieee754.in.h (_IEEE754_BYTE_ORDER, _IEEE754_BIG_ENDIAN)
(_IEEE754_LITTLE_ENDIAN, _IEEE754_FLOAT_WORD_ORDER): New macros.
All uses of __BYTE_ORDER, __BIG_ENDIAN, __LITTLE_ENDIAN,
__FLOAT_WORD_ORDER changed to use these new macros.
[!_GL_GNULIB_HEADER]: Include bits/endian.h, not endian.h,
as that’s what glibc does now.
[_GL_GNULIB_HEADER]: Include endian.h instead of rolling our own.
(__BEGIN_DECLS, __END_DECLS): Remove. All uses replaced
by definiens.
* modules/ieee754-h (Depends-on): Add endian.
Bruno Haible [Tue, 4 Jun 2024 01:59:37 +0000 (03:59 +0200)]
readlinkat: Work around a Cygwin 3.3.6 bug.
* m4/readlinkat.m4 (gl_FUNC_READLINKAT): Set REPLACE_READLINKAT to 1 on
Cygwin.
* lib/readlinkat.c (rpl_readlinkat): On Cygwin, for /dev/* files, don't
return results that start with a backslash.
* doc/posix-functions/readlinkat.texi: Mention the Cygwin bug.
Bruno Haible [Mon, 3 Jun 2024 23:48:04 +0000 (01:48 +0200)]
readlink: Work around a Cygwin 3.3.6 bug.
* m4/readlink.m4 (gl_FUNC_READLINK): Set REPLACE_READLINK to 1 on Cygwin.
* lib/readlink.c (rpl_readlink): On Cygwin, for /dev/* files, don't
return results that start with a backslash.
* tests/test-readlink.h (test_readlink): Add a test of /dev/null.
* tests/test-canonicalize-lgpl.c (main): Likewise.
* tests/test-canonicalize.c (main): Likewise.
* doc/posix-functions/readlink.texi: Mention the Cygwin bug.
Bruno Haible [Mon, 3 Jun 2024 15:20:20 +0000 (17:20 +0200)]
acl-permissions: Fix test-file-has-acl-2.sh failure on Cygwin.
* lib/acl-internal.c: Include <sys/types.h>, <grp.h>, <string.h>.
(acl_access_nontrivial): On Cygwin, ignore group:SYSTEM:*,
group:Administrators:*, mask::* entries.
* doc/acl-resources.txt: Add one more reference.
Bruno Haible [Mon, 3 Jun 2024 13:34:21 +0000 (15:34 +0200)]
dprintf-posix tests: Skip the memory leak test on macOS.
* tests/test-dprintf-posix2.c: Skip the test on macOS.
(main): Return a different exit code at each point. Allow 100 KB extra
memory consumption.
* tests/test-dprintf-posix2.sh: Update.
Collin Funk [Mon, 3 Jun 2024 11:57:14 +0000 (04:57 -0700)]
gnulib-tool.py: Use a set to optimize.
* pygnulib/GLModuleSystem.py
(GLModule.getAutomakeSnippet_Unconditional): Call set() on the result of
_extract_lib_SOURCES() to ensure computing the difference between
another set is O(n).
* pygnulib/GLModuleSystem.py (_LIB_SOURCES_PATTERN): New variable.
(_extract_lib_SOURCES): New function.
(GLModule.getAutomakeSnippet_Unconditional): Use the new function.
(GLModuleTable.add_dummy): Likewise. Add a second break statement to
stop unnecessary looping.
Bruno Haible [Sun, 2 Jun 2024 16:34:36 +0000 (18:34 +0200)]
isnanf, isnand, isnanl: Fix link errors on AIX 7.1 with xlc.
* lib/isnanf-nolibm.h (HAVE_ISNANF_NOLIBM): New macro.
* lib/isnand-nolibm.h (HAVE_ISNAND_NOLIBM): New macro.
* lib/isnanl-nolibm.h (HAVE_ISNANL_NOLIBM): New macro.
* lib/math.h (isnanf): Don't define via isnan if HAVE_ISNANF_NOLIBM is
defined.
(isnand): Don't define via isnan if HAVE_ISNAND_NOLIBM is defined.
(isnanl): Don't define via isnan if HAVE_ISNANL_NOLIBM is defined.
Collin Funk [Sun, 2 Jun 2024 08:06:32 +0000 (01:06 -0700)]
gnulib-tool.py: Fix crash when no ACLOCAL_AMFLAGS is found.
* pygnulib/main.py (main) [import]: Use a regular expression to match
the ACLOCAL_AMFLAGS Makefile.am variable. Properly handle the case where
none is found.
Bruno Haible [Fri, 31 May 2024 17:01:24 +0000 (19:01 +0200)]
windows-once: Fix race (regression yesterday).
* lib/windows-once.h (glwthread_once_t): Change type of inited to LONG.
* lib/windows-once.c (glwthread_once): Increment inited from 1 to 2, to
ensure that DeleteCriticalSection gets invoked only once.
Bruno Haible [Thu, 30 May 2024 18:06:58 +0000 (20:06 +0200)]
assert-h, verify: Fix compilation error with g++ (4.8.5) -std=gnu++11.
Reported by Harmen <harmen@stoppels.ch> at
<https://savannah.gnu.org/bugs/index.php?65811>.
* lib/verify.h (static_assert): In C++ mode with g++ < 6 and
-std=gnu++11, define in a way that supports also the 1-argument
invocations and the invocations inside C++ struct and class.
Bruno Haible [Thu, 30 May 2024 14:33:55 +0000 (16:33 +0200)]
attribute: Try harder to avoid syntax errors.
* m4/gnulib-common.m4 (gl_COMMON_BODY): Define
_GL_ATTRIBUTE_REPRODUCIBLE and _GL_ATTRIBUTE_UNSEQUENCED to empty if
_GL_BRACKET_BEFORE_ATTRIBUTE is defined.
Bruno Haible [Thu, 30 May 2024 08:55:40 +0000 (10:55 +0200)]
call_once: Work around Cygwin 3.5.3 bug.
* m4/call_once.m4 (gl_FUNC_CALL_ONCE): Require AC_CANONICAL_HOST.
On Cygwin, set REPLACE_CALL_ONCE to 1.
* lib/call_once.c (call_once): On Cygwin, use a cast, to avoid a
compiler warning.
* modules/call_once (Depends-on): Add pthread-once.
* doc/posix-functions/call_once.texi: Mention the Cygwin bug.
Bruno Haible [Thu, 30 May 2024 08:23:22 +0000 (10:23 +0200)]
windows-once: Free allocated resources when done.
Based on an observation regarding Cygwin's pthread_once implementation
by Takashi Yano <takashi.yano@nifty.ne.jp> at
<https://cygwin.com/pipermail/cygwin/2024-January/255182.html> and
<https://cygwin.com/pipermail/cygwin-patches/2024q1/012600.html>
* lib/windows-once.h (glwthread_once_t): Add field 'num_threads'.
(GLWTHREAD_ONCE_INIT): Initialize it to zero.
* lib/windows-once.c (glwthread_once): Increment num_threads while the
thread uses the lock. Let the last thread that uses the lock destroy it.
Bruno Haible [Wed, 29 May 2024 12:13:33 +0000 (14:13 +0200)]
mbfile tests: Avoid test failure on mingw.
* tests/test-mbfile.c: Include <string.h>, localcharset.h.
(main): Verify that setlocale() has installed an UTF-8 locale.
* modules/mbfile-tests (Depends-on): Add localcharset.
Collin Funk [Wed, 29 May 2024 04:55:12 +0000 (21:55 -0700)]
gnulib-tool.py: Simplify creation of module shell ids.
* pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): Remove class
variable.
(GLModule.shell_id_pattern): New class variable.
(GLModule.getShellId): New function.
(GLModule.getShellFunc, GLModule.getShellVar)
(GLModule.getConditionalName): Use it.