]> Savannah Git Hosting - gnulib.git/log
gnulib.git
11 months agoattribute: improve comments
Paul Eggert [Mon, 3 Jun 2024 16:58:27 +0000 (09:58 -0700)]
attribute: improve comments

* lib/attribute.h: Update comments to better reflect what
GCC actually does with pure and const functions.

11 months agoacl-permissions: Fix test-file-has-acl-2.sh failure on Cygwin.
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.

11 months agodprintf-posix tests: Skip the memory leak test on macOS.
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.

11 months agognulib-tool.py: Use a set to optimize.
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).

11 months agopthread-* tests, regex tests: Prepare for use of 'alarm'.
Bruno Haible [Mon, 3 Jun 2024 10:51:08 +0000 (12:51 +0200)]
pthread-* tests, regex tests: Prepare for use of 'alarm'.

* modules/pthread-cond-tests (configure.ac): Test whether 'alarm' is
declared.
* modules/pthread-mutex-tests (configure.ac): Likewise.
* modules/pthread-once-tests (configure.ac): Likewise.
* modules/pthread-rwlock-tests (configure.ac): Likewise.
* modules/pthread-tss-tests (configure.ac): Likewise.
* modules/regex-tests (configure.ac): Likewise.

11 months agomtx tests: Fix a possible link error.
Bruno Haible [Mon, 3 Jun 2024 10:43:06 +0000 (12:43 +0200)]
mtx tests: Fix a possible link error.

* modules/mtx-tests (Files): Add m4/semaphore.m4.
(configure.ac): Require gl_SEMAPHORE.
(Makefile.am): Link test-mtx with @LIB_SEMAPHORE@.

11 months agopthread-mutex, pthread-rwlock: Fix a compilation error.
Bruno Haible [Mon, 3 Jun 2024 10:30:32 +0000 (12:30 +0200)]
pthread-mutex, pthread-rwlock: Fix a compilation error.

* modules/pthread-mutex-tests (Files): Add m4/semaphore.m4.
(configure.ac): Check for semaphore.h. Require gl_SEMAPHORE.
* modules/pthread-rwlock-tests (Files): Add m4/semaphore.m4.
(configure.ac): Check for semaphore.h. Require gl_SEMAPHORE.

11 months agognulib-tool.py: Refactor duplicated regular expressions.
Collin Funk [Mon, 3 Jun 2024 05:32:39 +0000 (22:32 -0700)]
gnulib-tool.py: Refactor duplicated regular expressions.

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

11 months agoc-strtod, c-strtof, c-strtold: Fix link error on AIX.
Bruno Haible [Sun, 2 Jun 2024 20:35:23 +0000 (22:35 +0200)]
c-strtod, c-strtof, c-strtold: Fix link error on AIX.

* lib/c-strtod.c (newlocale): Undefine before use.

11 months agototalorder*: Avoid compilation error by IBM XL C compiler.
Bruno Haible [Sun, 2 Jun 2024 17:31:46 +0000 (19:31 +0200)]
totalorder*: Avoid compilation error by IBM XL C compiler.

* tests/test-totalorder.h (main) [__IBMC__]: Skip the test.
* tests/test-totalordermag.h (main) [__IBMC__]: Likewise.

11 months agoisnanf, isnand, isnanl: Fix link errors on AIX 7.1 with xlc.
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.

11 months agognulib-tool.py: Fix regular expression (regr. today).
Collin Funk [Sun, 2 Jun 2024 12:29:33 +0000 (05:29 -0700)]
gnulib-tool.py: Fix regular expression (regr. today).

* pygnulib/main.py (main) [import]: Match all characters until '#' or
end of line, whichever comes first.

11 months agognulib-tool.py: Fix crash when no ACLOCAL_AMFLAGS is found.
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.

11 months agowindows-once: Improve comments.
Bruno Haible [Sat, 1 Jun 2024 00:31:25 +0000 (02:31 +0200)]
windows-once: Improve comments.

* lib/windows-once.c (glwthread_once): Mention the 'started' field in
the comments.

11 months agowindows-once: Fix race (regression yesterday).
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.

11 months agowindows-once: Simplify.
Bruno Haible [Fri, 31 May 2024 16:45:20 +0000 (18:45 +0200)]
windows-once: Simplify.

* lib/windows-once.c (glwthread_once): Use InterlockedCompareExchange
instead of InterlockedIncrement.

11 months agopthread-once: Fix race in Cygwin workaround implementation.
Bruno Haible [Fri, 31 May 2024 13:25:30 +0000 (15:25 +0200)]
pthread-once: Fix race in Cygwin workaround implementation.

* lib/pthread-once.c (pthread_once): Test the 'done' word after
incrementing num_threads. Make sure to invoke pthread_mutex_destroy
only once.

11 months agopthread-once: Simplify Cygwin workaround implementation.
Bruno Haible [Fri, 31 May 2024 09:19:28 +0000 (11:19 +0200)]
pthread-once: Simplify Cygwin workaround implementation.

* lib/pthread-once.c (pthread_once): Use separate 16-bit words to store
the parts of the state.

11 months agopthread-once: Simplify Cygwin workaround implementation.
Bruno Haible [Thu, 30 May 2024 23:56:49 +0000 (01:56 +0200)]
pthread-once: Simplify Cygwin workaround implementation.

* lib/pthread-once.c (pthread_once): Use _Atomic instead of __sync_*
gcc primitives.

11 months agoassert-h, verify: Fix compilation error with g++ (4.8.5) -std=gnu++11.
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.

11 months agoendian: Unquote variables that are always defined.
Collin Funk [Thu, 30 May 2024 20:30:25 +0000 (13:30 -0700)]
endian: Unquote variables that are always defined.

* m4/endian.m4 (gl_ENDIAN_H): Unquote $ac_cv_header_endian_h and
$GL_GENERATE_ENDIAN_H.

11 months agoattribute: Try harder to avoid syntax errors.
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.

11 months agoattribute: Improve comments.
Bruno Haible [Thu, 30 May 2024 14:47:24 +0000 (16:47 +0200)]
attribute: Improve comments.

* m4/gnulib-common.m4 (gl_COMMON_BODY): Mention each macro name at the
beginning of its commentary.

11 months agoendian: Quote variables that may be undefined (regr. 2024-05-18).
Collin Funk [Thu, 30 May 2024 11:46:29 +0000 (04:46 -0700)]
endian: Quote variables that may be undefined (regr. 2024-05-18).

* m4/endian_h.m4 (gl_ENDIAN_H): Quote variables that are undefined on
some systems or may be defined by the user.

11 months agocall_once: Work around Cygwin 3.5.3 bug.
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.

11 months agowindows-once: Free allocated resources when done.
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.

11 months agoautoupdate
Karl Berry [Wed, 29 May 2024 15:08:39 +0000 (08:08 -0700)]
autoupdate

11 months agocall_once tests: Fix link error on mingw.
Bruno Haible [Wed, 29 May 2024 14:59:59 +0000 (16:59 +0200)]
call_once tests: Fix link error on mingw.

* modules/call_once-tests (Depends-on): Add mtx.

11 months agombfile tests: Avoid test failure on mingw.
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.

11 months agopthread-once tests: Fix crash on mingw.
Bruno Haible [Wed, 29 May 2024 11:41:20 +0000 (13:41 +0200)]
pthread-once tests: Fix crash on mingw.

* modules/pthread-once-tests (Depends-on): Add pthread-rwlock.

11 months agolock: Work around Cygwin 3.5.3 bug.
Bruno Haible [Wed, 29 May 2024 10:06:46 +0000 (12:06 +0200)]
lock: Work around Cygwin 3.5.3 bug.

* modules/lock (Depends-on): Add pthread-once.

11 months agognulib-tool.py: Don't emit non-ASCII shell output.
Collin Funk [Wed, 29 May 2024 09:35:02 +0000 (02:35 -0700)]
gnulib-tool.py: Don't emit non-ASCII shell output.

Reported by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00441.html>.

* pygnulib/GLModuleSystem.py (GLModule.shell_id_chars): Use the re.ASCII
flag for the regular expression.

11 months agognulib-tool.py: Add missing docstring.
Collin Funk [Wed, 29 May 2024 06:26:19 +0000 (23:26 -0700)]
gnulib-tool.py: Add missing docstring.

* pygnulib/GLModuleSystem.py (GLModule.getShellId): Add docstring
forgotten in the previous commit.

11 months agognulib-tool.py: Simplify creation of module shell ids.
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.

11 months agopthread-once: Work around Cygwin 3.5.3 bug.
Bruno Haible [Tue, 28 May 2024 20:35:54 +0000 (22:35 +0200)]
pthread-once: Work around Cygwin 3.5.3 bug.

* m4/pthread-once.m4 (gl_PTHREAD_ONCE): On Cygwin, set
REPLACE_PTHREAD_ONCE to 1.
* lib/pthread-once.c (pthread_once): Add an implementation for Cygwin.
* doc/posix-functions/pthread_once.texi: Mention the Cygwin bug.

11 months agoattribute: const/pure defaults to unsequenced/reproducible
Paul Eggert [Tue, 28 May 2024 15:36:28 +0000 (08:36 -0700)]
attribute: const/pure defaults to unsequenced/reproducible

Also, update the commentary to reflect the fact that unsequenced
and reproducible functions can inspect and update storage
addressed by their arguments, and clarify the business about
returning once, and about REPRODUCIBLE and UNSEQUENCED applying to
pointers to functions and to function types.  It’s not clear that
we should encourage the use of REPRODUCIBLE and UNSEQUENCED yet,
as the support is not there and the likely benefits are small.
* m4/gnulib-common.m4 (_GL_ATTRIBUTE_CONST): Default to
_GL_ATTRIBUTE_UNSEQUENCED if the const attribute is lacking,
as every const function is also unsequenced.
(_GL_ATTRIBUTE_PURE): Similarly, default to _GL_ATTRIBUTE_REPRODUCIBLE
as every pure function is reproducible.

11 months agomaint.mk: Update system header list for #include syntax checks.
Collin Funk [Tue, 28 May 2024 04:35:43 +0000 (21:35 -0700)]
maint.mk: Update system header list for #include syntax checks.

* top/maint.mk (gl_prefer_angle_bracket_headers_): Add byteswap.h,
endian.h, and stdbit.h.

11 months agodoc: Mention byteswap.h as a system header.
Collin Funk [Tue, 28 May 2024 04:26:48 +0000 (21:26 -0700)]
doc: Mention byteswap.h as a system header.

* doc/gnulib-tool.texi (Style of #include statements): Add byteswap.h.

11 months agonstrftime, c-nstrftime tests: Avoid test failures on native Windows.
Bruno Haible [Mon, 27 May 2024 22:35:03 +0000 (00:35 +0200)]
nstrftime, c-nstrftime tests: Avoid test failures on native Windows.

* doc/posix-functions/tzset.texi: Add a reference.
* tests/test-nstrftime.h (TZ): Use time zone names that are supported by
native Windows.
(LT): Disable a test of New Zealand DST.

11 months agonstrftime, c-nstrftime tests: Avoid some failures on native Windows.
Bruno Haible [Mon, 27 May 2024 22:24:02 +0000 (00:24 +0200)]
nstrftime, c-nstrftime tests: Avoid some failures on native Windows.

* tests/test-nstrftime.h (tzalloc_test): Fix typo in last commit.

11 months agonstrftime, c-nstrftime tests: Avoid some failures on native Windows.
Bruno Haible [Mon, 27 May 2024 22:10:42 +0000 (00:10 +0200)]
nstrftime, c-nstrftime tests: Avoid some failures on native Windows.

* tests/test-nstrftime.h (tzalloc_test): On native Windows, ignore
differences in the way the time zone is printed.

11 months agonstrftime, c-nstrftime: Make %r work on native Windows.
Bruno Haible [Mon, 27 May 2024 21:29:36 +0000 (23:29 +0200)]
nstrftime, c-nstrftime: Make %r work on native Windows.

* doc/posix-functions/strftime.texi: Mention the %r problem.
* lib/strftime.c (__strftime_internal): On native Windows, for %r, use
the English AM/PM format.

11 months agonstrftime, c-nstrftime: Make %h work on native Windows.
Bruno Haible [Mon, 27 May 2024 21:17:01 +0000 (23:17 +0200)]
nstrftime, c-nstrftime: Make %h work on native Windows.

* doc/posix-functions/strftime.texi: Mention the %h problem.
* lib/strftime.c (__strftime_internal): On native Windows, for %h, do a
%b directive.

11 months agonstrftime, c-nstrftime: Make %c work on native Windows.
Bruno Haible [Mon, 27 May 2024 21:01:50 +0000 (23:01 +0200)]
nstrftime, c-nstrftime: Make %c work on native Windows.

* doc/posix-functions/strftime.texi: Mention the %c problem.
* lib/strftime.c: Include <locale.h> always. Include hard-locale.h.
(__strftime_internal): For %c, use a subformat that contains the weekday
name (or abbrev.) and the month name (or abbrev.).
* modules/nstrftime (Depends-on): Add hard-locale.
(Link): New section.
* modules/nstrftime-tests (Makefile.am): Link test-nstrftime with
$(HARD_LOCALE_LIB).

11 months agotests: Fix internationalization problems on native Windows.
Bruno Haible [Mon, 27 May 2024 20:33:33 +0000 (22:33 +0200)]
tests: Fix internationalization problems on native Windows.

* doc/posix-functions/setlocale.texi: Clarify the deficiency of
setlocale() on native Windows.
* modules/c-nstrftime-tests (Depends-on): Add setlocale.
* modules/dfa-tests (Depends-on): Likewise.
* modules/hard-locale-tests (Depends-on): Likewise.
* modules/localcharset-tests (Depends-on): Likewise.
* modules/nstrftime-tests (Depends-on): Likewise.

11 months agonstrftime, c-nstrftime tests: Improve debuggability.
Bruno Haible [Mon, 27 May 2024 20:13:28 +0000 (22:13 +0200)]
nstrftime, c-nstrftime tests: Improve debuggability.

* tests/test-nstrftime.h (posixtm_test, tzalloc_test, quarter_test,
errno_test, locales_test): Flush output after every printf invocation.

11 months agoparse-datetime tests: Avoid failure on native Windows.
Bruno Haible [Mon, 27 May 2024 15:42:20 +0000 (17:42 +0200)]
parse-datetime tests: Avoid failure on native Windows.

* tests/test-parse-datetime.c (SOME_TIMEPOINT): New macro.
(main): Use it. On native Windows, use Windows time zone names.
Invoke tzset() after setting TZ.
* doc/posix-functions/gmtime.texi: Mention the native Windows problem.
* doc/posix-functions/localtime.texi: Likewise.

11 months agoautoupdate
Karl Berry [Mon, 27 May 2024 14:40:06 +0000 (07:40 -0700)]
autoupdate

11 months agotests: Don't test on the broken NetBSD 10.0 zh_CN.GB18030 locale.
Bruno Haible [Mon, 27 May 2024 11:13:38 +0000 (13:13 +0200)]
tests: Don't test on the broken NetBSD 10.0 zh_CN.GB18030 locale.

* tests/test-mbrtowc.c (main): Add tests for one-by-one input in the
UTF-8 and GB18030 encodings.
* m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Add a sanity check with mbrtowc.

11 months agoattribute: Support ISO C 23 [[reproducible]] and [[unsequenced]].
Bruno Haible [Mon, 27 May 2024 09:40:13 +0000 (11:40 +0200)]
attribute: Support ISO C 23 [[reproducible]] and [[unsequenced]].

* m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_ATTR_reproducible,
_GL_ATTR_unsequenced, _GL_ATTRIBUTE_REPRODUCIBLE,
_GL_ATTRIBUTE_UNSEQUENCED.
* lib/attribute.h (UNSEQUENCED, REPRODUCIBLE): New macros.

11 months agoeuidaccess: Fix test failure on native Windows.
Bruno Haible [Sat, 25 May 2024 13:48:32 +0000 (15:48 +0200)]
euidaccess: Fix test failure on native Windows.

* lib/euidaccess.c: Don't include <io.h>.
(euidaccess): On native Windows, invoke access, not _access.

11 months agomcel tests: Avoid test failures due to broken GB18030 converter.
Bruno Haible [Sat, 25 May 2024 10:39:14 +0000 (12:39 +0200)]
mcel tests: Avoid test failures due to broken GB18030 converter.

* tests/test-mcel.c (main): Fix mistake in last commit.

11 months agomcel tests: Avoid test failures due to broken GB18030 converter.
Bruno Haible [Sat, 25 May 2024 10:27:44 +0000 (12:27 +0200)]
mcel tests: Avoid test failures due to broken GB18030 converter.

* tests/test-mcel.c (main): Skip most GB18030 tests on platforms where
the GB18030 converter is known to be broken.

11 months agomcel tests: Fix typo.
Bruno Haible [Sat, 25 May 2024 10:16:53 +0000 (12:16 +0200)]
mcel tests: Fix typo.

* tests/test-mcel.c (main): Increment j instead of i.

11 months agouchar-c23: Speed up mbrtoc32 on Solaris 11.4.
Bruno Haible [Sat, 25 May 2024 10:14:29 +0000 (12:14 +0200)]
uchar-c23: Speed up mbrtoc32 on Solaris 11.4.

* lib/lc-charset-unicode.c (get_converters): Cache the return value.

11 months agotests: Refactor.
Bruno Haible [Sat, 25 May 2024 09:46:11 +0000 (11:46 +0200)]
tests: Refactor.

* tests/test-inttostr.c (main): Report SKIP in the 'if' branch.
* tests/test-quotearg.c (main): Likewise.

11 months agotests: Before declaring a SKIP, test if there were ASSERT failures.
Bruno Haible [Sat, 25 May 2024 09:44:21 +0000 (11:44 +0200)]
tests: Before declaring a SKIP, test if there were ASSERT failures.

* HACKING: Document idiom to use with test_exit_status.
* tests/test-c32isalnum.c (main): If there were ASSERT failures, report
them instead of declaring SKIP.
* tests/test-c32isalpha.c (main): Likewise.
* tests/test-c32isblank.c (main): Likewise.
* tests/test-c32iscntrl.c (main): Likewise.
* tests/test-c32isdigit.c (main): Likewise.
* tests/test-c32isgraph.c (main): Likewise.
* tests/test-c32islower.c (main): Likewise.
* tests/test-c32isprint.c (main): Likewise.
* tests/test-c32ispunct.c (main): Likewise.
* tests/test-c32isspace.c (main): Likewise.
* tests/test-c32isupper.c (main): Likewise.
* tests/test-c32isxdigit.c (main): Likewise.
* tests/test-c32rtomb.c (main): Likewise.
* tests/test-c32rtomb-w32.c (main): Likewise.
* tests/test-c32snrtombs.c (main): Likewise.
* tests/test-c32srtombs.c (main): Likewise.
* tests/test-c32stombs.c (main): Likewise.
* tests/test-c32tolower.c (main): Likewise.
* tests/test-c32toupper.c (main): Likewise.
* tests/test-canonicalize.c (main): Likewise.
* tests/test-canonicalize-lgpl.c (main): Likewise.
* tests/test-duplocale.c (main): Likewise.
* tests/test-fbufmode.c (main): Likewise.
* tests/test-fenv-except-state-3.c (main): Likewise.
* tests/test-fenv-except-trapping-1.c (main): Likewise.
* tests/test-fenv-except-trapping-2.c (main): Likewise.
* tests/test-fnmatch.c (main): Likewise.
* tests/test-fnmatch-w32.c (main): Likewise.
* tests/test-fpurge.c (main): Likewise.
* tests/test-freadable.c (main): Likewise.
* tests/test-fseek.c (main): Likewise.
* tests/test-fseeko.c (main): Likewise.
* tests/test-ftell.c (main): Likewise.
* tests/test-ftell3.c (main): Likewise.
* tests/test-ftello.c (main): Likewise.
* tests/test-ftello3.c (main): Likewise.
* tests/test-fwritable.c (main): Likewise.
* tests/test-fwriting.c (main): Likewise.
* tests/test-getrandom.c (main): Likewise.
* tests/test-mbrlen-w32.c (main): Likewise.
* tests/test-mbrtoc16.c (main): Likewise.
* tests/test-mbrtoc16-w32.c (main): Likewise.
* tests/test-mbrtoc32.c (main): Likewise.
* tests/test-mbrtoc32-w32.c (main): Likewise.
* tests/test-mbrtowc-w32.c (main): Likewise.
* tests/test-mbsnrtoc32s.c (main): Likewise.
* tests/test-mbsrtoc32s.c (main): Likewise.
* tests/test-mbstoc32s.c (main): Likewise.
* tests/test-nl_langinfo2.c (main): Likewise.
* tests/test-nstrftime.c (main): Likewise.
* tests/test-passfd.c (main): Likewise.
* tests/test-posix_spawn-script.c (main): Likewise.
* tests/test-posix_spawnp-script.c (main): Likewise.
* tests/test-ptsname.c (main): Likewise.
* tests/test-ptsname_r.c (main): Likewise.
* tests/test-remove.c (main): Likewise.
* tests/test-strfmon_l.c (main): Likewise.
* tests/test-utime.c (main): Likewise.
* tests/test-wcrtomb-w32.c (main): Likewise.
* tests/test-execute-script.c (main): Obey CONTINUE_AFTER_ASSERT better.
* tests/test-spawn-pipe-script.c (main): Likewise.
* tests/test-linkat.c (main): Use the common idiom.

11 months agobyteswap tests: Verify header can be used from C++.
Collin Funk [Sat, 25 May 2024 08:20:01 +0000 (01:20 -0700)]
byteswap tests: Verify header can be used from C++.

* modules/byteswap-c++-tests: New file.
* tests/test-byteswap-c++.cc: New file.
* modules/byteswap-tests (Depends-on): Add byteswap-c++-tests.

11 months agoreadutmp: Fix dependencies.
Collin Funk [Sat, 25 May 2024 03:59:51 +0000 (20:59 -0700)]
readutmp: Fix dependencies.

* modules/readutmp (Depends-on): Add gettimeofday.

11 months agoboot-time, readutmp: Add a Native Windows boot time fallback.
Collin Funk [Sat, 25 May 2024 02:23:25 +0000 (19:23 -0700)]
boot-time, readutmp: Add a Native Windows boot time fallback.

* lib/boot-time-aux.h (initialize, get_windows_boot_time_fallback): New
functions.
* lib/boot-time.c [_WIN32 && !__CYGWIN__]: Include Windows headers and
<sys/time.h>.
(get_boot_time_uncached): Use the fallback.
* lib/readutmp.c [_WIN32 && !__CYGWIN__]: Include Windows headers and
<sys/time.h>.
(read_utmp_from_file): Use the fallback.
* modules/boot-time (Depends-on): Add gettimeofday.

11 months agoputenv tests: Put the putenv() argument strings into writable memory.
Bruno Haible [Fri, 24 May 2024 10:38:54 +0000 (12:38 +0200)]
putenv tests: Put the putenv() argument strings into writable memory.

* tests/test-putenv.c (main): Declare static variables of type 'char[]',
not 'char *'.

11 months agombrtoc32 tests: Avoid failure on Solaris 11.4 (regression yesterday).
Bruno Haible [Fri, 24 May 2024 09:52:46 +0000 (11:52 +0200)]
mbrtoc32 tests: Avoid failure on Solaris 11.4 (regression yesterday).

* tests/test-mbrtoc32.c (main): Conditionalize an assertion with
GL_CHAR32_T_IS_UNICODE.

11 months agoputenv tests: Silence -Wanalyzer-putenv-of-auto-var.
Collin Funk [Fri, 24 May 2024 05:52:36 +0000 (22:52 -0700)]
putenv tests: Silence -Wanalyzer-putenv-of-auto-var.

* tests/test-putenv.c (main): Declare static variables to pass to
putenv.

11 months agoPOSIX.1-2024 has been approved
Paul Eggert [Fri, 24 May 2024 02:39:29 +0000 (19:39 -0700)]
POSIX.1-2024 has been approved

It hasn’t been published yet, so just update documentation talking
about “draft” POSIX, about particular POSIX versions, etc.
More work will need to be done once it’s published on the web,
to update URLs, better document new and changed interfaces,
and presumably to implement some of the new interfaces.

11 months agombrtoc32: Strengthen tests.
Bruno Haible [Thu, 23 May 2024 21:58:06 +0000 (23:58 +0200)]
mbrtoc32: Strengthen tests.

* tests/test-mbrtoc32.c (main): Add tests for one-by-one input in the
UTF-8 and GB18030 encodings.

11 months agombrtoc32: Work around bug in Cygwin 3.5.3.
Bruno Haible [Thu, 23 May 2024 21:46:52 +0000 (23:46 +0200)]
mbrtoc32: Work around bug in Cygwin 3.5.3.

* m4/mbrtoc32.m4 (gl_MBRTOC32_UTF8_LOCALE): New macro.
(gl_FUNC_MBRTOC32): Invoke it. If mbrtoc32 has this bug, define
MBRTOC32_MULTIBYTE_LOCALE_BUG and reset LOCALE_ZH_CN to 'none'.
* lib/mbrtoc32.c (mbrtoc32): Test MBRTOC32_MULTIBYTE_LOCALE_BUG.
* doc/posix-functions/mbrtoc32.texi: Mention the Cygwin bug.

11 months agosethostname tests: Avoid test failure on Cygwin.
Bruno Haible [Thu, 23 May 2024 17:13:16 +0000 (19:13 +0200)]
sethostname tests: Avoid test failure on Cygwin.

* tests/test-sethostname2.c (main): On Cygwin, skip the "too long
hostname" test.
* doc/glibc-functions/sethostname.texi: Mention the Cygwin problem.

11 months agoaccess, euidaccess tests: Avoid test failures on Cygwin.
Bruno Haible [Thu, 23 May 2024 15:36:05 +0000 (17:36 +0200)]
access, euidaccess tests: Avoid test failures on Cygwin.

* tests/test-access.h (test_access): On Cygwin, don't test for the
absence of the W_OK permission.

11 months agoc32is*, c32toupper tests: Avoid test failures on Cygwin.
Bruno Haible [Thu, 23 May 2024 15:00:58 +0000 (17:00 +0200)]
c32is*, c32toupper tests: Avoid test failures on Cygwin.

* tests/test-c32isalpha.c (main): Disable tests that fail on
Cygwin 3.5.3.
* tests/test-c32iscntrl.c (main): Likewise.
* tests/test-c32isgraph.c (main): Likewise.
* tests/test-c32islower.c (main): Likewise.
* tests/test-c32isprint.c (main): Likewise.
* tests/test-c32ispunct.c (main): Likewise.
* tests/test-c32toupper.c (main): Likewise.

11 months agopoll tests: Avoid test failure on Cygwin.
Bruno Haible [Thu, 23 May 2024 14:25:01 +0000 (16:25 +0200)]
poll tests: Avoid test failure on Cygwin.

* tests/test-poll.c (test_pipe): Disable the POLLHUP check also on
Cygwin.
* doc/posix-functions/poll.texi: Mention also Cygwin w.r.t. POLLHUP.

11 months agopassfd tests: Mark as expected failure on Cygwin.
Bruno Haible [Thu, 23 May 2024 13:41:52 +0000 (15:41 +0200)]
passfd tests: Mark as expected failure on Cygwin.

* tests/test-passfd.c (main): Always fail on Cygwin.
* modules/passfd-tests (Depends-on): Add test-xfail.
(Makefile.am): Expect that test-passfd fails on Cygwin.

11 months agorenameatu: Work around Cygwin 3.4.6 bug.
Bruno Haible [Thu, 23 May 2024 13:15:40 +0000 (15:15 +0200)]
renameatu: Work around Cygwin 3.4.6 bug.

* m4/renameat.m4 (gl_FUNC_RENAMEAT): Test whether renameat2 works, and
define HAVE_WORKING_RENAMEAT2 if so.
* lib/renameatu.c (renameatu): Test HAVE_WORKING_RENAMEAT2 instead of
HAVE_RENAMEAT2.
* doc/glibc-functions/renameat2.texi: Mention the Cygwin bug.

11 months agoreadlinkat, areadlinkat: Avoid test failures on Cygwin 3.4.6.
Bruno Haible [Thu, 23 May 2024 10:47:00 +0000 (12:47 +0200)]
readlinkat, areadlinkat: Avoid test failures on Cygwin 3.4.6.

* tests/test-readlink.h (test_readlink): For an empty file name, allow
errno == EBADF.
* tests/test-areadlink.h (test_areadlink): Likewise.

11 months agodoc: Small updates regarding Cygwin.
Bruno Haible [Thu, 23 May 2024 10:16:59 +0000 (12:16 +0200)]
doc: Small updates regarding Cygwin.

* doc/glibc-functions/fallocate.texi: Update for Cygwin 3.5.x.
* doc/posix-functions/c8rtomb.texi: Likewise.
* doc/posix-functions/c16rtomb.texi: Likewise.
* doc/posix-functions/c32rtomb.texi: Likewise.
* doc/posix-functions/lseek.texi: Likewise.
* doc/posix-functions/mbrtoc8.texi: Likewise.
* doc/posix-functions/mbrtoc16.texi: Likewise.
* doc/posix-functions/mbrtoc32.texi: Likewise.
* doc/posix-functions/posix_spawnp.texi: Likewise.

11 months agoiconv: Reject the broken macOS 14.4 iconv implementation.
Bruno Haible [Wed, 22 May 2024 23:10:18 +0000 (01:10 +0200)]
iconv: Reject the broken macOS 14.4 iconv implementation.

Reported by Daniel Collins <solemnwarning@solemnwarning.net> at
<https://savannah.gnu.org/bugs/?65686>.

* m4/iconv.m4 (AM_ICONV_LINK): In the test "for working iconv", test
against the macOS 14.4 iconv bug.
* doc/posix-functions/iconv.texi: Document the bug.

11 months agostdlib: Handle glibc special invocation conventions correctly.
Bruno Haible [Wed, 22 May 2024 22:53:39 +0000 (00:53 +0200)]
stdlib: Handle glibc special invocation conventions correctly.

* lib/stdlib.in.h: Undefine __need_malloc_and_calloc after doing the

11 months agoc-strtod: include <stdio.h>
Paul Eggert [Wed, 22 May 2024 06:32:14 +0000 (23:32 -0700)]
c-strtod: include <stdio.h>

* lib/c-strtod.c: Include <stdio.h>, since we call sprintf.
Problem found by Oracle Developer Studio 12.6 on Solaris 10.

11 months agogetusershell: Split file by lines instead of spaces.
Collin Funk [Tue, 21 May 2024 23:35:09 +0000 (16:35 -0700)]
getusershell: Split file by lines instead of spaces.

* lib/getusershell.c: Include string.h and filename.h
(GNULIB_GETUSERSHELL_SINGLE_THREAD): Remove conditional to include
unlocked stdio functions that are no longer used.
(readname): Remove function.
(getusershell): Use getline and process the string instead of using
readname. Return the first absolute file name.
* modules/getusershell (Depends-on): Remove unlocked-io-internal.
Add getline and filename.
* doc/multithread.texi (Multithreading Optimizations): Don't mention
GNULIB_GETUSERSHELL_SINGLE_THREAD.

11 months agoboot-time: port to Alpine 3.20.0_rc2
Paul Eggert [Tue, 21 May 2024 22:49:40 +0000 (15:49 -0700)]
boot-time: port to Alpine 3.20.0_rc2

* lib/boot-time-aux.h (get_openbsd_boot_time):
Port to Alpine Linux, which had bogus timestamps on /var/run/utmp.

11 months agotrim tests: Avoid test failure on Solaris 11 OmniOS.
Bruno Haible [Tue, 21 May 2024 21:10:37 +0000 (23:10 +0200)]
trim tests: Avoid test failure on Solaris 11 OmniOS.

* tests/test-trim.c (main): Skip the failing test on Illumos.

11 months agomcel tests: Run the test in several locales.
Bruno Haible [Tue, 21 May 2024 19:20:15 +0000 (21:20 +0200)]
mcel tests: Run the test in several locales.

* tests/test-mcel-1.sh: New file, based on tests/test-mbrtowc-1.sh.
* tests/test-mcel-2.sh: New file, based on tests/test-mbrtowc-2.sh.
* tests/test-mcel-3.sh: New file, based on tests/test-mbrtowc-3.sh.
* tests/test-mcel-4.sh: New file, based on tests/test-mbrtowc-4.sh.
* tests/test-mcel-5.sh: New file, based on tests/test-mbrtowc-5.sh.
* modules/mcel-tests (Files): Add them. Add tests/macros.h,
m4/locale-fr.m4, m4/locale-ja.m4, m4/locale-zh.m4, m4/codeset.m4.
(Depends-on): Remove assert-h.
(configure.ac, Makefile.am): Essentially copy from
modules/mbrtowc-tests.

11 months agoflock tests: Mark as expected failure on Solaris 11.
Bruno Haible [Tue, 21 May 2024 17:52:42 +0000 (19:52 +0200)]
flock tests: Mark as expected failure on Solaris 11.

* modules/flock-tests (Makefile.am): Expect that test-flock fails with
the Gnulib fallback.

11 months agoFix "'gl_CHECK_HEADER_SYS_CDEFS_H' was expanded before it was required".
Bruno Haible [Tue, 21 May 2024 16:31:49 +0000 (18:31 +0200)]
Fix "'gl_CHECK_HEADER_SYS_CDEFS_H' was expanded before it was required".

* m4/sys_cdefs_h.m4 (gl_CHECK_HEADER_SYS_CDEFS_H): Define through
AC_DEFUN_ONCE.

11 months agoaccess, euidaccess tests: Avoid test failure for root user on Solaris.
Bruno Haible [Tue, 21 May 2024 13:32:06 +0000 (15:32 +0200)]
access, euidaccess tests: Avoid test failure for root user on Solaris.

* tests/test-access.h (test_access): On Solaris, for the root user,
don't expect X_OK permissions to be absent.
* doc/posix-functions/access.texi: Mention the Solaris problem.
* doc/glibc-functions/euidaccess.texi: Likewise.

11 months agofnmatch tests: Avoid test failure on OmniOS.
Collin Funk [Tue, 21 May 2024 09:40:14 +0000 (02:40 -0700)]
fnmatch tests: Avoid test failure on OmniOS.

Using the GB18030 locale OmniOS doesn't match U+00D7 MULTIPLICATION SIGN
as a punctuation character.

* tests/test-fnmatch.c (main): Skip the test. Discovered by CI test
using OmniOS r151048 and reproduced on OmniOS r151050.

11 months agovasnprintf: Don't abort for pseudo-denormal arguments on macOS 12.
Bruno Haible [Mon, 20 May 2024 22:33:55 +0000 (00:33 +0200)]
vasnprintf: Don't abort for pseudo-denormal arguments on macOS 12.

Reported by Gaëtan Herfray <g.herfray@gahfy.io> via Erik Blake in
<https://lists.gnu.org/archive/html/bug-m4/2022-03/msg00002.html>
<https://lists.gnu.org/archive/html/bug-gnulib/2022-03/msg00066.html>.

* lib/vasnprintf.c (safe_frexpl): New function.
(decode_long_double, floorlog10l): Invoke it instead of frexpl.

11 months agogetopt-posix: port better to Alpine 3.20.0_rc1
Paul Eggert [Mon, 20 May 2024 21:55:11 +0000 (14:55 -0700)]
getopt-posix: port better to Alpine 3.20.0_rc1

Alpine’s <sys/cdefs.h> is a stub that issues a deprecation #warning.
* m4/getopt.m4 (gl_GETOPT_SUBSTITUTE_HEADER):
* m4/sched_h.m4 (gl_SCHED_H): Use the new macro
gl_CHECK_HEADER_SYS_CDEFS_H instead of checking independently.
* m4/sys_cdefs_h.m4: New file.
* modules/getopt-posix, modules/sched (Files): Add m4/sys_cdefs_h.m4.

11 months agotests: Update expected tests results on NetBSD.
Collin Funk [Mon, 20 May 2024 21:34:11 +0000 (14:34 -0700)]
tests: Update expected tests results on NetBSD.

These tests were fixed by the previous commit.
* modules/fdutimensat-tests (Depends-on): Remove test-xfail.
(Makefile.am): Expect that test-fdutimensat succeeds on NetBSD.
* modules/futimens-tests (Depends-on): Remove test-xfail.
(Makefile.am): Expect that test-futimens succeeds on NetBSD.
* modules/utimens-tests (Depends-on): Remove test-xfail.
(Makefile.am): Expect that test-utimens succeeds on NetBSD.
* modules/utimensat-tests (Depends-on): Remove test-xfail.
(Makefile.am): Expect that test-utimensat succeeds on NetBSD.

11 months agoutimensat, utimens: Work around NetBSD 10.0 bugs.
Collin Funk [Mon, 20 May 2024 21:23:41 +0000 (14:23 -0700)]
utimensat, utimens: Work around NetBSD 10.0 bugs.

* lib/utimens.c (fdutimens): Work around a NetBSD 10.0 UTIME_OMIT bug in
the same way as Linux kernel 2.6.32 and Solaris 11.1.
(lutimens): Likewise.
* lib/utimensat.c (rpl_utimensat): Likewise. Workaround a NetBSD 10.0
bug where invalid tv_nsec values are not rejected in the same way as
Linux kernel 2.6.22.19 on hppa.
* doc/posix-functions/utimensat.texi: Document the invalid tv_nsec bug.

11 months agobyteswap: fix problem on macOS
Paul Eggert [Mon, 20 May 2024 17:10:07 +0000 (10:10 -0700)]
byteswap: fix problem on macOS

* m4/byteswap.m4 (gl_BYTESWAP): Quote a variable that might not
be defined (or the user may have defined it to something with spaces!).
Problem reported by Mattias Engdegård for Emacs on macOS.

11 months agolinkat-tests: fix up assertion-failure changes
Paul Eggert [Mon, 20 May 2024 16:54:26 +0000 (09:54 -0700)]
linkat-tests: fix up assertion-failure changes

* tests/test-linkat.c (main): Don’t lose the failure results of
earlier tests.  Problem found by Coverity.

11 months agodfa: attempt to pacify Coverity
Paul Eggert [Mon, 20 May 2024 16:52:52 +0000 (09:52 -0700)]
dfa: attempt to pacify Coverity

* lib/dfa.c (lex): Use ‘assume’ rather than ‘abort’,
to try to pacify Coverity.
(maybe_disable_superset_dfa): Use ‘assume’ here too, for consistency.
Using ‘assume’ should make the code a tiny bit faster, though
at the cost of having undefined behavior instead of nicely aborting.

11 months ago* m4/byteswap.m4: Add comment about broken C libraries.
Paul Eggert [Mon, 20 May 2024 16:08:27 +0000 (09:08 -0700)]
* m4/byteswap.m4: Add comment about broken C libraries.

11 months agoMake it easy to generate debug info for libbacktrace on macOS.
Bruno Haible [Mon, 20 May 2024 15:17:34 +0000 (17:17 +0200)]
Make it easy to generate debug info for libbacktrace on macOS.

* build-aux/macos-compile: New file.

11 months agostdint: Verify the width of 'long long' before using it as int64_t.
Bruno Haible [Mon, 20 May 2024 11:12:50 +0000 (13:12 +0200)]
stdint: Verify the width of 'long long' before using it as int64_t.

Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00315.html>.

* lib/stdint.in.h (gl_int64_t): Verify that the number of bits of
'long long' is 64 before using it.
(gl_uint64_t): Verify that the number of bits of 'unsigned long long'
is 64 before using it.

11 months agogetusershell: Work around musl bugs.
Collin Funk [Sun, 19 May 2024 23:40:34 +0000 (16:40 -0700)]
getusershell: Work around musl bugs.

Reported by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00261.html>.

* doc/glibc-functions/getusershell.texi: Mention the musl bug.
* lib/unistd.in.h (getusershell, setusershell, endusershell): Allow the
functions to be declared with the rpl_ prefix.
* m4/getusershell.m4 (gl_FUNC_GETUSERSHELL): Prepare functions to be
replaced on musl systems.
(gl_PREREQ_GETUSERSHELL): New macro.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize
REPLACE_GETUSERSHELL.
* modules/getusershell (Depends-on): Update module conditions to account
for the function being available but replaced by Gnulib.
(configure.ac): Likewise. Invoke gl_PREREQ_GETUSERSHELL.

11 months agoabort-debug: Prefer libbacktrace to execinfo.
Bruno Haible [Sun, 19 May 2024 13:55:21 +0000 (15:55 +0200)]
abort-debug: Prefer libbacktrace to execinfo.

* lib/abort-debug.c: Include <backtrace.h>.
(state): New variable.
(print_stack_trace): Add another implementation.
(_gl_pre_abort, rpl_abort): Also test HAVE_LIBBACKTRACE.
* m4/abort-debug.m4 (gl_ABORT_DEBUG_EARLY): Check for libbacktrace.
Set LIBS, not LDFLAGS.

11 months agomkfifoat: Work around a macOS 14 bug.
Bruno Haible [Sun, 19 May 2024 09:55:13 +0000 (11:55 +0200)]
mkfifoat: Work around a macOS 14 bug.

* m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Also test the case of a dangling
symlink.
* doc/posix-functions/mkfifoat.texi: Mention the macOS bug.

11 months agosha512-buffer: port back to 32-bit-only hosts
Paul Eggert [Sun, 19 May 2024 02:02:48 +0000 (19:02 -0700)]
sha512-buffer: port back to 32-bit-only hosts

Port to platforms lacking 64-bit integers (something that Emacs
still attempts to do, in theory) by adding an u64bswap primitive
to u64.h and using that, instead of using bswap_64.  This fixes a
bug I made in commit 0d45ec7c033c165ad73a6509c7fa84aa67edf4ea
dated Sun Jun 17 14:35:37 2018 -0700.
* lib/sha512.c (SWAP): Use u64bswap, not bswap_64, to port
to older platforms lacking 64-bit integers.
* lib/u64.h: Include stddef.h, for size_t.
Include byteswap.h, for bswap_64 (on platforms with 64-bit int),
bswap_32.
(u64rol): Now a function, not a macro, so that it evaluates
its args only once.
(u64uint32): New typedef.
(u64, u64hilo, u64lo): Use it.
(_GL_U64_MASK32): New macro.
(u64size, u64plus, u64shl, u64shr, u64plus): Use it as needed for
odd platforms where unsigned int is wider than 32 bits.
(u64lt): Return bool, not int.
* modules/u64 (Depends-on): Add byteswap, stdbool.
* tests/test-u64.c (main): Test u64bswap.

11 months agodup3: Update documentation and expected test results.
Collin Funk [Sun, 19 May 2024 00:34:09 +0000 (17:34 -0700)]
dup3: Update documentation and expected test results.

* doc/glibc-functions/dup3.texi: Mention NetBSD bug fixed by the Gnulib
implementation after the previous commit.
* modules/dup3-tests (Depends-on): Remove test-xfail.
(Makefile.am): Don't expect test-dup3 to fail on NetBSD.