]> Savannah Git Hosting - gnulib.git/log
gnulib.git
4 years agotests: fix signed overflow issues
Paul Eggert [Sun, 21 Mar 2021 21:52:08 +0000 (14:52 -0700)]
tests: fix signed overflow issues

* tests/test-dynarray.c (value_at): Avoid undefined behavior
in signed integer multiplication.
* tests/test-scratch-buffer.c (byte_at): Likewise, for the
theoretically-possible case where size_t is narrower than int.

4 years agodoc: More updates.
Bruno Haible [Sun, 21 Mar 2021 15:03:57 +0000 (16:03 +0100)]
doc: More updates.

* doc/glibc-functions/sethostname.texi: Update regarding macOS.
* doc/glibc-functions/sethostname.texi: List the affected platforms.

4 years agodoc: Update for macOS 11.1.
Bruno Haible [Sun, 21 Mar 2021 13:56:02 +0000 (14:56 +0100)]
doc: Update for macOS 11.1.

* doc/posix-headers/*.texi: Update.
* doc/glibc-headers/*.texi: Update.
* doc/posix-functions/*.texi: Likewise.
* doc/pastposix-functions/*.texi: Likewise.
* doc/glibc-functions/*.texi: Likewise.
* m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Update cross-compilation
guess.

4 years agoftell: Document bug in macOS >= 10.15.
Bruno Haible [Sun, 21 Mar 2021 11:30:33 +0000 (12:30 +0100)]
ftell: Document bug in macOS >= 10.15.

* doc/posix-functions/ftell.texi: Mention the macOS bug.

4 years agoftello: Work around bug in macOS >= 10.15.
Bruno Haible [Sun, 21 Mar 2021 02:46:05 +0000 (03:46 +0100)]
ftello: Work around bug in macOS >= 10.15.

Reported by Martin Storsjö <martin@martin.st> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00002.html>.

* m4/ungetc.m4 (gl_FUNC_UNGETC_WORKS): On macOS, don't define
FUNC_UNGETC_BROKEN. Instead, set gl_ftello_broken_after_ungetc to yes.
* m4/ftello.m4 (gl_FUNC_FTELLO): Invoke gl_FUNC_UNGETC_WORKS, and
arrange to provide the workaround if ftello is broken after ungetc.
* lib/ftello.c: Include <errno.h>, intprops.h.
(ftello) [FTELLO_BROKEN_AFTER_UNGETC]: Implement from scratch.
* modules/ftello (Files): Add m4/ungetc.m4.
(Depends-on): Add intprops.
* doc/posix-functions/ftello.texi: Mention the macOS bug.

4 years agomath C++ tests: Fix compilation error on macOS 11.2.
Bruno Haible [Sat, 20 Mar 2021 21:34:16 +0000 (22:34 +0100)]
math C++ tests: Fix compilation error on macOS 11.2.

* lib/math.in.h (isnan): For clang >= 12 on macOS, declare 'rpl_isnan',
not 'isnan'.

4 years agosimple-atomic tests: Fix compilation error on Solaris 10.
Bruno Haible [Fri, 19 Mar 2021 02:47:23 +0000 (03:47 +0100)]
simple-atomic tests: Fix compilation error on Solaris 10.

Reported by Tom G. Christensen <tgc@jupiterrise.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00085.html>.

* tests/test-simple-atomic.c (yield): Define only after all #includes.

4 years agosimple-atomic: Fix compilation error on Solaris 10/x86_64 with cc.
Bruno Haible [Fri, 19 Mar 2021 02:38:53 +0000 (03:38 +0100)]
simple-atomic: Fix compilation error on Solaris 10/x86_64 with cc.

* lib/simple-atomic.c (atomic_compare_and_swap_ptr): Correct asm
instruction.

4 years agoargmatch: fix testing typo
Paul Eggert [Thu, 18 Mar 2021 18:00:53 +0000 (11:00 -0700)]
argmatch: fix testing typo

Problem and fix reported by Gisle Vanem in:
https://lists.gnu.org/r/bug-gnulib/2021-03/msg00083.html
* lib/argmatch.c (main) [TEST]: Fix address-of typo.

4 years agoautoupdate
Karl Berry [Tue, 16 Mar 2021 15:14:30 +0000 (08:14 -0700)]
autoupdate

4 years agointprops: improve commentary
Paul Eggert [Mon, 15 Mar 2021 04:28:40 +0000 (21:28 -0700)]
intprops: improve commentary

* lib/intprops.h: Improve comments about promotion etc.

4 years agotime_rz: Put reference documentation into the .h file.
Bruno Haible [Sun, 14 Mar 2021 18:22:07 +0000 (19:22 +0100)]
time_rz: Put reference documentation into the .h file.

* lib/time.in.h (timezone_t, tzalloc, tzfree, localtime_rz, mktime_z):
Add comments, based on modules/time_rz.
* modules/time_rz (Comment): Remove section.

4 years agoparse-datetime tests: Avoid a test failure on NetBSD.
Bruno Haible [Sun, 14 Mar 2021 18:19:07 +0000 (19:19 +0100)]
parse-datetime tests: Avoid a test failure on NetBSD.

Reported by Thomas Klausner <tk@giga.or.at> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00069.html>.

* tests/test-parse-datetime.c (main): Skip two tests on NetBSD.

4 years agoautoupdate
Karl Berry [Thu, 11 Mar 2021 19:26:27 +0000 (11:26 -0800)]
autoupdate

4 years agolibc-config: port to DragonFlyBSD 5.9
Paul Eggert [Wed, 10 Mar 2021 23:04:55 +0000 (15:04 -0800)]
libc-config: port to DragonFlyBSD 5.9

DragonFlyBSD defines __nonnull incompatibly with glibc,
so avoid the use of __nonnull in Gnulib code.
Problem reported by Gavin Smith in:
https://lists.gnu.org/r/bug-gnulib/2021-03/msg00066.html
* lib/cdefs.h (__attribute_nonnull__): Rename from __nonnull.
All uses in Gnulib changed.  There should be no need to change
glibc code that is not shared with Gnulib.
(__nonnull): New macro, defined in terms of __attribute_nonnull__,
and which can be used in glibc code that is not shared with Gnulib.

4 years agomanywarnings: modernize documentation
Paul Eggert [Sun, 7 Mar 2021 21:47:02 +0000 (13:47 -0800)]
manywarnings: modernize documentation

Problem reported by Reuben Thomas in:
https://lists.gnu.org/r/bug-gnulib/2021-03/msg00046.html
* doc/manywarnings.texi (manywarnings): Update in
the light of recent changes to the manywarnings module.

4 years agosysexits: Fix for Haiku.
Bruno Haible [Sun, 7 Mar 2021 11:24:07 +0000 (12:24 +0100)]
sysexits: Fix for Haiku.

* lib/sysexits.in.h: Don't assume that <sysexits.h>, when it exists,
defines anything.
* doc/glibc-headers/sysexits.texi: Mention the Haiku bug.

4 years agoRename GNULIB_WCHAR_SINGLE to GNULIB_WCHAR_SINGLE_LOCALE.
Bruno Haible [Sun, 7 Mar 2021 09:45:58 +0000 (10:45 +0100)]
Rename GNULIB_WCHAR_SINGLE to GNULIB_WCHAR_SINGLE_LOCALE.

* lib/lc-charset-dispatch.c: Test GNULIB_WCHAR_SINGLE_LOCALE instead of
GNULIB_WCHAR_SINGLE.
* lib/wcwidth.c: Likewise.
* tests/test-wcwidth.c: Likewise.
* doc/multithread.texi: Document GNULIB_WCHAR_SINGLE_LOCALE instead of
GNULIB_WCHAR_SINGLE.
* NEWS: Document the change.

4 years agombrtowc: Allow locking optimization independently of 'unlocked-io'.
Bruno Haible [Sun, 7 Mar 2021 01:57:46 +0000 (02:57 +0100)]
mbrtowc: Allow locking optimization independently of 'unlocked-io'.

* lib/mbtowc-lock.h: Test GNULIB_MBRTOWC_SINGLE_THREAD instead of
USE_UNLOCKED_IO.
* doc/multithread.texi: Document GNULIB_MBRTOWC_SINGLE_THREAD.

4 years agoregex: Allow locking optimization independently of 'unlocked-io'.
Bruno Haible [Sun, 7 Mar 2021 01:47:03 +0000 (02:47 +0100)]
regex: Allow locking optimization independently of 'unlocked-io'.

* lib/regex_internal.h: Test GNULIB_REGEX_SINGLE_THREAD instead of
USE_UNLOCKED_IO.
* doc/multithread.texi: Document GNULIB_REGEX_SINGLE_THREAD.

4 years agoexclude: Allow stdio optimization independently of 'unlocked-io'.
Bruno Haible [Sun, 7 Mar 2021 01:42:24 +0000 (02:42 +0100)]
exclude: Allow stdio optimization independently of 'unlocked-io'.

* lib/exclude.c: Test GNULIB_EXCLUDE_SINGLE_THREAD instead of
USE_UNLOCKED_IO.
* modules/exclude (Depends-on): Add unlocked-io-internal.
* doc/multithread.texi: Document GNULIB_EXCLUDE_SINGLE_THREAD.

4 years agoreadutmp: Optimize stdio accesses.
Bruno Haible [Sun, 7 Mar 2021 01:36:31 +0000 (02:36 +0100)]
readutmp: Optimize stdio accesses.

* lib/readutmp.c: Include unlocked-io.h unconditionally.
* modules/readutmp (Depends-on): Add unlocked-io-internal.

4 years agomountlist: Optimize stdio accesses.
Bruno Haible [Sun, 7 Mar 2021 01:31:45 +0000 (02:31 +0100)]
mountlist: Optimize stdio accesses.

* lib/mountlist.c: Include unlocked-io.h unconditionally.
* modules/mountlist (Depends-on): Add unlocked-io-internal.

4 years agogetusershell: Optimize stdio accesses when possible.
Bruno Haible [Sun, 7 Mar 2021 01:21:49 +0000 (02:21 +0100)]
getusershell: Optimize stdio accesses when possible.

* lib/getusershell.c: Test GNULIB_GETUSERSHELL_SINGLE_THREAD instead of
USE_UNLOCKED_IO.
* modules/getusershell (Depends-on): Add unlocked-io-internal.
* doc/multithread.texi: Document GNULIB_GETUSERSHELL_SINGLE_THREAD.

4 years agounlocked-io-internal: New module.
Bruno Haible [Sun, 7 Mar 2021 00:58:10 +0000 (01:58 +0100)]
unlocked-io-internal: New module.

* m4/unlocked-io.m4 (gl_FUNC_GLIBC_UNLOCKED_IO): Don't define
USE_UNLOCKED_IO here.
* modules/unlocked-io-internal: New file, based on modules/unlocked-io.
* modules/unlocked-io (Description): Clarify.
(Files, Depends-on): Just use the unlocked-io-internal module.
(configure.ac): Define GNULIB_STDIO_SINGLE_THREAD and USE_UNLOCKED_IO
here.
* doc/multithread.texi: Clarify when the 'unlocked-io' module can be
used.

4 years agoposixtm: Remove unused includes.
Bruno Haible [Sun, 7 Mar 2021 00:39:16 +0000 (01:39 +0100)]
posixtm: Remove unused includes.

* lib/posixtm.c: Don't include <stdio.h>, <sys/types.h>, unlocked-io.h.

4 years agodynarray: Add tests.
Bruno Haible [Sat, 6 Mar 2021 23:41:44 +0000 (00:41 +0100)]
dynarray: Add tests.

* tests/test-dynarray.c: New file.
* modules/dynarray-tests: New file.

4 years agodynarray: Make the module usable on its own.
Bruno Haible [Sat, 6 Mar 2021 23:40:27 +0000 (00:40 +0100)]
dynarray: Make the module usable on its own.

* lib/dynarray.h: Document the exported API. Comments taken from
lib/malloc/dynarray-skeleton.c and lib/malloc/dynarray.h.
Distinguish an internal include from an include for instantiation.
In the latter case, include <libc-config.h> and
<malloc/dynarray-skeleton.c>.
* modules/dynarray (Depends-on): Add intprops.
(Include): Reduce to just "dynarray.h".

4 years agoscratch_buffer: Add comment.
Bruno Haible [Sat, 6 Mar 2021 23:27:13 +0000 (00:27 +0100)]
scratch_buffer: Add comment.

* lib/scratch_buffer.h: Add comment.

4 years agoparse-datetime2: fix licensing
Paul Eggert [Sat, 6 Mar 2021 16:23:48 +0000 (08:23 -0800)]
parse-datetime2: fix licensing

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2021-03/msg00017.html
* gnulib-tool (func_get_license): Treat parse-datetime2
(actually, anything starting with "parse-datetime")
like parse-datetime, as far as licenses go.

4 years agofree-posix: Update documentation.
Bruno Haible [Sat, 6 Mar 2021 12:49:52 +0000 (13:49 +0100)]
free-posix: Update documentation.

* doc/posix-functions/free.texi: Add platform details.

4 years agodoc: Update for glibc 2.33.
Bruno Haible [Sat, 6 Mar 2021 12:49:30 +0000 (13:49 +0100)]
doc: Update for glibc 2.33.

* doc/glibc-functions/mallinfo2.texi: New file.
* doc/gnulib.texi: Include it.
(Glibc sys/vtimes.h): Remove section.
* doc/glibc-functions/vtimes.texi: Remove file.
* doc/pastposix-functions/h_errno.texi: Update.
* doc/posix-functions/*.texi: Likewise.
* doc/glibc-functions/*.texi: Likewise.

4 years agostddef: Generalize tcc workaround to other compilers.
Bruno Haible [Thu, 4 Mar 2021 23:21:53 +0000 (00:21 +0100)]
stddef: Generalize tcc workaround to other compilers.

Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00027.html>.

* lib/stddef.in.h: Undefine the __need_* macros with all compilers.
* doc/posix-headers/stddef.texi: Mention that the TinyCC bug also exists
on macOS.

4 years agostdalign: port to tcc + glibc
Paul Eggert [Thu, 4 Mar 2021 08:47:19 +0000 (00:47 -0800)]
stdalign: port to tcc + glibc

* lib/stdalign.in.h (_Alignas): Do not define using __attribute__
if __attribute__ is defined as a macro, as __attribute__ surely a
no-op in that case and this is an area where __attribute__ cannot
simply be ignored.
* m4/stdalign.m4 (gl_STDALIGN_H): Include <stdint.h> so that
it #defines __attribute__(x) to nothing on glibc-based systems
when non-GNU-C-compatible compilers are used.
This exposes a bug in Tiny C Compiler 0.9.27’s implementation
of _Alignas on glibc platforms.

4 years agoasyncsafe-spin, simple-atomic: Add support for tcc/x86.
Bruno Haible [Thu, 4 Mar 2021 01:18:15 +0000 (02:18 +0100)]
asyncsafe-spin, simple-atomic: Add support for tcc/x86.

* lib/asyncsafe-spin.c (memory_barrier): With tcc/x86, don't use the
'mfence' instruction.
* lib/simple-atomic.c (memory_barrier): Likewise.

4 years agoasyncsafe-spin, simple-atomic: Add support for tcc.
Bruno Haible [Wed, 3 Mar 2021 12:32:41 +0000 (13:32 +0100)]
asyncsafe-spin, simple-atomic: Add support for tcc.

* lib/asyncsafe-spin.c (memory_barrier, atomic_compare_and_swap): On
i386 and x86_64, treat tcc like older GCC or clang.
* lib/simple-atomic.c (memory_barrier, atomic_compare_and_swap,
atomic_compare_and_swap_ptr): Likewise.

4 years agostddef: Work around an interoperability problem of tcc with glibc.
Bruno Haible [Wed, 3 Mar 2021 02:56:50 +0000 (03:56 +0100)]
stddef: Work around an interoperability problem of tcc with glibc.

Reported by Luca Saiu <positron@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00011.html>.

* lib/stddef.in.h [__TINYC__]: In case of the special invocation
convention, undefine the macros that TinyCC's <stddef.h> should undefine
but doesn't.
* doc/posix-headers/stddef.texi: Mention the TinyCC bug.

4 years agombrtowc: port to AIX 7.1 with xlc 12.1
Paul Eggert [Wed, 3 Mar 2021 00:27:39 +0000 (16:27 -0800)]
mbrtowc: port to AIX 7.1 with xlc 12.1

Fix a problem with locks when building GNU Tar (Savannah commit
55f2a0772e08b9febac3ac0de5cb048d4c60d2f5) on AIX 7.1 with IBM XL
C/C++ V12.1 using ‘./configure CC=xlc’.  The link fails due to
missing definitions of pthread_mutex_lock and
pthread_mutex_unlock.  GNU Tar uses unlocked-io and so
should not need to worry about multithreading or locks.
* lib/mbtowc-lock.h (mbtowc_with_lock) [USE_UNLOCKED_IO]:
Don’t bother with locks, since this app is single-threaded.
There may be similar linking problems with lib/nl_langinfo.c and
lib/setlocale_null.c but my GNU Tar build didn’t run into them, so
I left them alone for now.

4 years ago* modules/parse-datetime2: New file.
Paul Eggert [Mon, 1 Mar 2021 08:48:47 +0000 (00:48 -0800)]
* modules/parse-datetime2: New file.

4 years agounlocked-io: do not redefine getc_unlocked etc.
Paul Eggert [Mon, 1 Mar 2021 08:27:25 +0000 (00:27 -0800)]
unlocked-io: do not redefine getc_unlocked etc.

I ran into this problem on AIX 7.1 with GNU Tar, which
enables visibility of getc_unlocked etc. after testing
whether they’re declared, causing argp-namefrob.h and
unlocked-io.h to redefine the macros.
* lib/argp-namefrob.h, lib/unlocked-io.h:
(clearerr_unlocked, feof_unlocked ferror_unlocked)
(fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked)
(fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked)
(putc_unlocked, putchar_unlocked): Do not define if already defined.

4 years agoparse-datetime2: new module
Paul Eggert [Mon, 1 Mar 2021 08:24:05 +0000 (00:24 -0800)]
parse-datetime2: new module

This splits the old parse-datetime into two parts; the
first is parse-datetime2 which supports all the new bells
and whistles, the second is parse-datetime, which reverts to
its original intent.  This avoids some bogus diagnostics
when build GNU Tar with gcc -flto -fanalyze and
with --enable-gcc-warnings.  And it slims down the
executable a bit.
* NEWS: Mention this.
* lib/parse-datetime.y (parser_control) [!GNULIB_PARSE_DATETIME2]:
Omit parse_datetime_debug member.
(debugging): New function.  Use it everywhere the old code
would load parse_datetime_debug.
(parse_datetime_body): New static function, with the body
of the old parse_datetime2.  Set pc.parse_datetime_debug
only if GNULIB_PARSE_DATETIME2.
(parse_datetime2, parse_datetime): Use this new function.
(parse_datetime2) [!GNULIB_PARSE_DATETIME2]: Remove.

4 years agostring-buffer: Fixes.
Bruno Haible [Sat, 27 Feb 2021 17:12:09 +0000 (18:12 +0100)]
string-buffer: Fixes.

* modules/string-buffer (License): Change to LGPL.
* tests/test-string-buffer.c (main): Add another sb_appendf call, that
is more likely to fail.

4 years agogitlog-to-changelog: output SHA in "empty commit message" warning
Bernhard Voelker [Wed, 24 Feb 2021 23:58:25 +0000 (00:58 +0100)]
gitlog-to-changelog: output SHA in "empty commit message" warning

* build-aux/gitlog-to-changelog: Add $sha to above warning diagnostic.

4 years agoglob: include libc-config.h only if needed
Paul Eggert [Wed, 24 Feb 2021 19:36:06 +0000 (11:36 -0800)]
glob: include libc-config.h only if needed

4 years agoglob: include libc-config.h in a more-standard way
Paul Eggert [Wed, 24 Feb 2021 18:52:59 +0000 (10:52 -0800)]
glob: include libc-config.h in a more-standard way

Inspired by Tom Tromey’s report for RHEL 6 in:
https://lists.gnu.org/r/bug-gnulib/2021-02/msg00088.html
* lib/glob.c [!_LIBC]: Include libc-config.h, not just config.h

4 years agoautoupdate
Karl Berry [Wed, 24 Feb 2021 17:40:33 +0000 (09:40 -0800)]
autoupdate

4 years agostring-buffer: Add tests.
Bruno Haible [Sun, 21 Feb 2021 20:41:53 +0000 (21:41 +0100)]
string-buffer: Add tests.

* tests/test-string-buffer.c: New file.
* modules/string-buffer-tests: New file.

4 years agostring-buffer: New module.
Bruno Haible [Sun, 21 Feb 2021 20:39:07 +0000 (21:39 +0100)]
string-buffer: New module.

* lib/string-buffer.h: New file.
* lib/string-buffer.c: New file.
* modules/string-buffer: New file.
* doc/posix-functions/open_memstream.texi: Mention the new module.

4 years agoscratch_buffer: Document the exported API.
Bruno Haible [Sun, 21 Feb 2021 18:32:36 +0000 (19:32 +0100)]
scratch_buffer: Document the exported API.

* lib/scratch_buffer.h: Add comments, taken from
lib/malloc/scratch_buffer.h.

4 years agoDEPENDENCIES: Update.
Bruno Haible [Sun, 21 Feb 2021 18:21:42 +0000 (19:21 +0100)]
DEPENDENCIES: Update.

* DEPENDENCIES: Require GCC >= 3.1. Tell where to find working GNU m4
tarballs. Mention awk. Point to pre-built packages for gettext, bison,
gperf, texinfo.

4 years agoparse-datetime: Fix comment.
Bruno Haible [Sat, 20 Feb 2021 13:13:17 +0000 (14:13 +0100)]
parse-datetime: Fix comment.

* modules/parse-datetime (Makefile.am): Fix comment.

4 years agopassfd: Fix test failure on FreeBSD >= 12 and NetBSD in 64-bit mode.
Bruno Haible [Wed, 17 Feb 2021 02:22:58 +0000 (03:22 +0100)]
passfd: Fix test failure on FreeBSD >= 12 and NetBSD in 64-bit mode.

* lib/passfd.c (recvfd): Use the CMSG_SPACE macro to compute the value
for msg_controllen.

4 years agoPort better to macOS Mojave
Paul Eggert [Tue, 16 Feb 2021 19:41:19 +0000 (11:41 -0800)]
Port better to macOS Mojave

Problem reported by Tom Shields in:
https://lists.gnu.org/r/bug-gnulib/2021-02/msg00064.html
* config/srclist.txt: Comment out dynarray_finalize.c.
* lib/dynarray.h (__libc_dynarray_at_failure): Don’t include
libc-config.h here, as that’s the includer’s responsibility.
* lib/malloc/dynarray_at_failure.c:
* lib/malloc/dynarray_emplace_enlarge.c:
* lib/malloc/dynarray_finalize.c:
* lib/malloc/dynarray_resize.c:
* lib/malloc/dynarray_resize_clear.c:
If _LIBC is not defined, include libc-config.h.

4 years agolinked-list test: Add test for SIGNAL_SAFE_LIST. (It currently fails.)
Bruno Haible [Tue, 16 Feb 2021 00:31:39 +0000 (01:31 +0100)]
linked-list test: Add test for SIGNAL_SAFE_LIST. (It currently fails.)

* tests/test-asyncsafe-linked_list.sh: New file.
* tests/test-asyncsafe-linked_list.c: New file.
* modules/linked-list-tests (Files): Add them.
(Depends-on): Add thread, yield, nanosleep, sigaction, sigprocmask.
(Makefile.am): Arrange to compile test-asyncsafe-linked_list.c and run
test-asyncsafe-linked_list.sh.

4 years agosimple-atomic: Add tests.
Bruno Haible [Mon, 15 Feb 2021 03:29:18 +0000 (04:29 +0100)]
simple-atomic: Add tests.

* tests/test-simple-atomic.c: New file.
* modules/simple-atomic-tests: New file.

4 years agosimple-atomic: New module.
Bruno Haible [Mon, 15 Feb 2021 03:25:38 +0000 (04:25 +0100)]
simple-atomic: New module.

* lib/simple-atomic.h: New file.
* lib/simple-atomic.c: New file, based on lib/asyncsafe-spin.c.
* modules/simple-atomic: New file.

4 years agoFix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX.
Bruno Haible [Mon, 15 Feb 2021 02:41:12 +0000 (03:41 +0100)]
Fix distinction of 32-bit/64-bit mode with xlc 13.1.3 on AIX.

* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI, gl_HOST_CPU_C_ABI_32BIT):
Test __LP64__ instead of _ARCH_PPC64.
* m4/lib-ld.m4 (AC_LIB_PROG_LD): Likewise.
* lib/stddef.in.h: Likewise.

4 years agoCorrect placement of last ChangeLog entry.
Bruno Haible [Mon, 15 Feb 2021 02:35:27 +0000 (03:35 +0100)]
Correct placement of last ChangeLog entry.

4 years agolib-symbol-visibility: Make it work with -Wmissing-prototypes.
Ozkan Sezer [Thu, 11 Feb 2021 15:39:56 +0000 (18:39 +0300)]
lib-symbol-visibility: Make it work with -Wmissing-prototypes.

* m4/visibility.m4 (gl_VISIBILITY): Avoid error from simultaneous use of
-Wmissing-prototypes and -Werror.

4 years agostddef: Fix test-stddef compilation error on MidnightBSD/x86.
Bruno Haible [Mon, 8 Feb 2021 22:18:34 +0000 (23:18 +0100)]
stddef: Fix test-stddef compilation error on MidnightBSD/x86.

* lib/stddef.in.h (_GL_STDDEF_ALIGNAS, rpl_max_align_t, max_align_t):
Don't ignore HAVE_MAX_ALIGN_T if the compiler is clang.

4 years agoDocument non-standard prototypes on MidnightBSD.
Bruno Haible [Mon, 8 Feb 2021 20:35:14 +0000 (21:35 +0100)]
Document non-standard prototypes on MidnightBSD.

* doc/posix-functions/initstate.texi: Mention different prototype on
MidnightBSD 2.0.
* doc/posix-functions/srandom.texi: Likewise.
* doc/posix-functions/getlogin_r.texi: Likewise.
* doc/glibc-functions/sethostname.texi: Likewise.

4 years agoposixtm tests: Fix warnings seen on MidnightBSD/x86.
Bruno Haible [Mon, 8 Feb 2021 20:32:22 +0000 (21:32 +0100)]
posixtm tests: Fix warnings seen on MidnightBSD/x86.

* tests/test-posixtm.c (main): Convert two 'time_t' values to 'long' for
printing.

4 years agoAdd cross-compilation guesses for MidnightBSD.
Bruno Haible [Sun, 7 Feb 2021 20:33:13 +0000 (21:33 +0100)]
Add cross-compilation guesses for MidnightBSD.

* m4/malloc.m4 (_AC_FUNC_MALLOC_IF): When cross-compiling, use the
result from native compilation.
* m4/realloc.m4 (_AC_FUNC_REALLOC_IF): Likewise.
* m4/mbrtoc32.m4 (gl_MBRTOC32_SANITYCHECK): Likewise.
* m4/mprotect.m4 (gl_FUNC_MPROTECT_WORKS): Likewise.
* m4/posix_spawn.m4 (gl_POSIX_SPAWN_SECURE): Likewise.
* m4/printf.m4 (gl_PRINTF_SIZES_C99, gl_PRINTF_INFINITE,
gl_PRINTF_INFINITE_LONG_DOUBLE, gl_PRINTF_DIRECTIVE_F,
gl_SNPRINTF_TRUNCATION_C99, gl_SNPRINTF_RETVAL_C99,
gl_SNPRINTF_DIRECTIVE_N, gl_VSNPRINTF_ZEROSIZE_C99): Likewise.
* m4/strfmon_l.m4 (gl_FUNC_STRFMON_L): Likewise.
* m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Use predetermined
result on MidnightBSD.

4 years agothreadlib: Add support for MidnightBSD.
Bruno Haible [Sun, 7 Feb 2021 19:26:12 +0000 (20:26 +0100)]
threadlib: Add support for MidnightBSD.

* m4/threadlib.m4 (gl_WEAK_SYMBOLS, gl_THREADLIB_BODY): On MidnightBSD,
use the same test as on FreeBSD.

4 years agohost-os: Add support for MidnightBSD.
Bruno Haible [Sun, 7 Feb 2021 19:00:55 +0000 (20:00 +0100)]
host-os: Add support for MidnightBSD.

* m4/host-os.m4 (gl_HOST_OS): On MidnightBSD, set HOST_OPERATING_SYSTEM
to "MidnightBSD", not "Midnightbsd".

4 years agoc-stack: Adjust for MidnightBSD.
Bruno Haible [Sun, 7 Feb 2021 18:55:47 +0000 (19:55 +0100)]
c-stack: Adjust for MidnightBSD.

* m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): On MidnightBSD,
set FAULT_YIELDS_SIGBUS.

4 years agorelocatable-prog: Add support for MidnightBSD.
Bruno Haible [Sun, 7 Feb 2021 18:31:02 +0000 (19:31 +0100)]
relocatable-prog: Add support for MidnightBSD.

* m4/relocatable.m4 (gl_RELOCATABLE_BODY): Use the ELF $ORIGIN trick
also on MidnightBSD >= 1.1.
* build-aux/config.libpath: Treat MidnightBSD like FreeBSD.
* build-aux/reloc-ldflags: Likewise.

4 years agohavelib: Add support for MidnightBSD.
Bruno Haible [Sun, 7 Feb 2021 18:25:29 +0000 (19:25 +0100)]
havelib: Add support for MidnightBSD.

* build-aux/config.rpath: Treat MidnightBSD like FreeBSD >= 4.

4 years agowcwidth: Document MidnightBSD bug.
Bruno Haible [Sun, 7 Feb 2021 16:34:59 +0000 (17:34 +0100)]
wcwidth: Document MidnightBSD bug.

* doc/posix-functions/wcwidth.texi: Mention MidnightBSD as an affected
platform.
* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Update comments.

4 years agopthread_sigmask: Document MidnightBSD bug.
Bruno Haible [Sun, 7 Feb 2021 16:31:24 +0000 (17:31 +0100)]
pthread_sigmask: Document MidnightBSD bug.

* doc/posix-functions/pthread_sigmask.texi: Mention MidnightBSD as an
affected platform.
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Update
cross-compilation guess accordingly.

4 years agoimmutable: Avoid test failures on MidnightBSD.
Bruno Haible [Sun, 7 Feb 2021 16:24:32 +0000 (17:24 +0100)]
immutable: Avoid test failures on MidnightBSD.

* tests/test-immutable.c (install_segv_handler): On FreeBSD, install the
handler also for SIGBUS.

4 years agoc32is*: Avoid test failures on MidnightBSD.
Bruno Haible [Sun, 7 Feb 2021 16:17:29 +0000 (17:17 +0100)]
c32is*: Avoid test failures on MidnightBSD.

* tests/test-c32isalnum.c (main): On FreeBSD, disable tests that fail on
MidnightBSD 1.1.
* tests/test-c32isalpha.c (main): Likewise.
* tests/test-c32isblank.c (main): Likewise.
* tests/test-c32islower.c (main): Likewise.
* tests/test-c32isupper.c (main): Likewise.

4 years agoregex: fix comment location
Paul Eggert [Sat, 6 Feb 2021 01:08:45 +0000 (17:08 -0800)]
regex: fix comment location

* lib/regexec.c (update_regs): Move comment.

4 years agoregex-tests: add bug 11053 test
Paul Eggert [Sat, 6 Feb 2021 01:08:39 +0000 (17:08 -0800)]
regex-tests: add bug 11053 test

* tests/test-regex.c (main): New test case for glibc bug 11053.

4 years agoregex: debug check for set member duplicates
Paul Eggert [Sat, 6 Feb 2021 01:08:29 +0000 (17:08 -0800)]
regex: debug check for set member duplicates

* lib/regex_internal.c (re_node_set_insert): Add a DEBUG_ASSERT
that would have caught some recently-fixed performance bugs
that caused sets to contain duplicate members.

4 years agoregex: fix longstanding backref match bug
Paul Eggert [Sat, 6 Feb 2021 01:08:10 +0000 (17:08 -0800)]
regex: fix longstanding backref match bug

This fixes a longstanding glibc bug concerning backreferences
<https://sourceware.org/11053> (2009-12-04).
* lib/regexec.c (proceed_next_node, push_fail_stack)
(pop_fail_stack): Push and pop the previous registers
as well as the current ones.  All callers changed.
(set_regs): Also pop if CUR_NODE has already been checked,
so that it does not get added as a duplicate set entry.
(update_regs): Fix comment location.
* tests/test-regex.c (tests): New constant.
(bug_regex11): New test function.
(main): Bump alarm value.  Call new test function.

4 years agoregex: avoid duplicate in espilon closure
Paul Eggert [Sat, 6 Feb 2021 00:35:46 +0000 (16:35 -0800)]
regex: avoid duplicate in espilon closure

* lib/regcomp.c (calc_eclosure_iter): Insert NODE into epsilon
closure first rather than last.  Otherwise, the epsilon closure
might contain a duplicate of NODE.

4 years agoregex-tests: fix typo
Paul Eggert [Sat, 6 Feb 2021 00:35:46 +0000 (16:35 -0800)]
regex-tests: fix typo

* tests/test-regex.c (main): Fix typo that would have caused an
old test case to report incorrect values on failure.

4 years agoregex: make it easier to merge into glibc
Paul Eggert [Sat, 6 Feb 2021 00:35:46 +0000 (16:35 -0800)]
regex: make it easier to merge into glibc

* lib/regex_internal.h [_LIBC]: Do not include Gnulib’s dynarray.h.

4 years agoregex: minor refactoring
Paul Eggert [Sat, 6 Feb 2021 00:35:45 +0000 (16:35 -0800)]
regex: minor refactoring

* lib/regexec.c (proceed_next_node): Use more-local decls.

4 years agoregex: avoid undefined behavior
Paul Eggert [Sat, 6 Feb 2021 00:35:45 +0000 (16:35 -0800)]
regex: avoid undefined behavior

* lib/regexec.c (pop_fail_stack): If the stack is empty, return -1
instead of indulging in undefined behavior.  This simplifies
callers, and avoids undefined behavior in some cases (see glibc
bug 11053, though this change does not fix that overall bug).

4 years agoregex: improve comments
Paul Eggert [Sat, 6 Feb 2021 00:35:45 +0000 (16:35 -0800)]
regex: improve comments

* lib/regexec.c: Add and correct comments about return values.

4 years agorelocatable-prog-wrapper: Tweak today's patch.
Bruno Haible [Sun, 31 Jan 2021 13:28:03 +0000 (14:28 +0100)]
relocatable-prog-wrapper: Tweak today's patch.

* build-aux/install-reloc (func_create_wrapper): Clean up free.o.

4 years agofmaf: Document QEMU bug
Bruno Haible [Sun, 31 Jan 2021 12:27:42 +0000 (13:27 +0100)]
fmaf: Document QEMU bug

* doc/posix-functions/fmaf.texi: Add note about QEMU bug.

4 years agoremainderl: Work around musl libc bug.
Bruno Haible [Sun, 31 Jan 2021 12:21:24 +0000 (13:21 +0100)]
remainderl: Work around musl libc bug.

* doc/posix-functions/remainderl.texi: Document musl libc bug.
* m4/remainderl.m4 (gl_FUNC_REMAINDERL_WORKS): Add more tests. Update
cross compilation guess.

4 years agolog2l: Work around musl libc bugs.
Bruno Haible [Sun, 31 Jan 2021 12:20:28 +0000 (13:20 +0100)]
log2l: Work around musl libc bugs.

* doc/posix-functions/log2l.texi: Document musl libc bugs.
* m4/log2l.m4 (gl_FUNC_LOG2L_WORKS): Add more tests. Update cross
compilation guess.

4 years agolog1pl: Work around musl libc bug.
Bruno Haible [Sun, 31 Jan 2021 12:19:17 +0000 (13:19 +0100)]
log1pl: Work around musl libc bug.

* doc/posix-functions/log1pl.texi: Document musl libc bug.
* m4/log1pl.m4 (gl_FUNC_LOG1PL_WORKS): New macro.
(gl_FUNC_LOG1PL): Invoke it.

4 years agolog10l: Document musl libc bug.
Bruno Haible [Sun, 31 Jan 2021 12:16:30 +0000 (13:16 +0100)]
log10l: Document musl libc bug.

* doc/posix-functions/log10l.texi: Document musl libc bug.
* m4/log10l.m4 (gl_FUNC_LOG10L_WORKS): Update comment and cross
compilation guess.

4 years agologl: Document musl libc bug.
Bruno Haible [Sun, 31 Jan 2021 12:15:38 +0000 (13:15 +0100)]
logl: Document musl libc bug.

* doc/posix-functions/logl.texi: Document musl libc bug.
* m4/logl.m4 (gl_FUNC_LOGL_WORKS): Update comment and cross
compilation guess.

4 years agoexpm1l: Document musl libc bug.
Bruno Haible [Sun, 31 Jan 2021 12:14:29 +0000 (13:14 +0100)]
expm1l: Document musl libc bug.

* doc/posix-functions/expm1l.texi: Document musl libc bug.
* m4/expm1l.m4 (gl_FUNC_EXPM1L): Update comment and cross
compilation guess.

4 years agoexpl: Document musl libc bug.
Bruno Haible [Sun, 31 Jan 2021 12:10:58 +0000 (13:10 +0100)]
expl: Document musl libc bug.

* doc/posix-functions/expl.texi: Document musl libc bug.
* m4/expl.m4 (gl_FUNC_EXPL): Update comment and cross
compilation guess.

4 years agorelocatable-prog-wrapper: Update after recent changes.
Bruno Haible [Sun, 31 Jan 2021 11:42:47 +0000 (12:42 +0100)]
relocatable-prog-wrapper: Update after recent changes.

* lib/relocwrapper.c: Update comments.
* modules/relocatable-prog-wrapper (Files): Add lib/scratch_buffer.h,
lib/malloc/scratch_buffer*, lib/malloc.c, lib/realloc.c, lib/free.c,
lib/mempcpy.c, lib/rawmemchr.c, m4/lstat.m4. Remove lib/lstat.c.
(Depends-on): Add c99, eloop-threshold, fcntl-h, idx, intprops,
libc-config, stddef, sys_stat. Remove alloca-opt.
(configure.ac): Invoke gl_FUNC_MALLOC_POSIX, gl_FUNC_REALLOC_POSIX,
gl_FUNC_FREE, gl_FUNC_MEMPCPY, gl_FUNC_RAWMEMCHR.
* lib/canonicalize-lgpl.c (memmove): Undefine in the relocwrapper.
* build-aux/install-reloc (func_create_wrapper): Compile also
malloc/scratch_buffer_*.c, malloc.c, realloc.c, free.c, mempcpy.c,
rawmemchr.c. Don't compile lstat.c.

4 years agoMake it possible to compile rawmemchr.c separately, unconditionally.
Bruno Haible [Sun, 31 Jan 2021 11:42:33 +0000 (12:42 +0100)]
Make it possible to compile rawmemchr.c separately, unconditionally.

* lib/rawmemchr.c: Don't define rawmemchr if not needed.

4 years agoMake it possible to compile mempcpy.c separately, unconditionally.
Bruno Haible [Sun, 31 Jan 2021 11:42:21 +0000 (12:42 +0100)]
Make it possible to compile mempcpy.c separately, unconditionally.

* lib/mempcpy.c: Don't define mempcpy if not needed.

4 years agoMake it possible to compile free.c separately, unconditionally.
Bruno Haible [Sun, 31 Jan 2021 11:41:33 +0000 (12:41 +0100)]
Make it possible to compile free.c separately, unconditionally.

* m4/free.m4 (gl_FUNC_FREE): Define HAVE_FREE_POSIX.
* lib/free.c: Don't define rpl_free if not needed.

4 years agoMake it possible to compile realloc.c separately, unconditionally.
Bruno Haible [Sun, 31 Jan 2021 11:39:31 +0000 (12:39 +0100)]
Make it possible to compile realloc.c separately, unconditionally.

* modules/realloc-posix (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/realloc.c: Don't define rpl_realloc if not needed.

4 years agoMake it possible to compile malloc.c separately, unconditionally.
Bruno Haible [Sun, 31 Jan 2021 11:30:18 +0000 (12:30 +0100)]
Make it possible to compile malloc.c separately, unconditionally.

* modules/malloc-posix (configure.ac): Invoke gl_MODULE_INDICATOR.
* lib/malloc.c: Don't define rpl_malloc if not needed.

4 years agocanonicalize-lgpl: Simplify.
Bruno Haible [Sun, 31 Jan 2021 11:35:45 +0000 (12:35 +0100)]
canonicalize-lgpl: Simplify.

* lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC): Remove macro.

4 years agocanonicalize, canonicalize-lgpl: Straighten dependencies.
Bruno Haible [Sun, 31 Jan 2021 11:29:47 +0000 (12:29 +0100)]
canonicalize, canonicalize-lgpl: Straighten dependencies.

* modules/canonicalize-lgpl (Depends-on): Remove free-posix,
malloc-posix. Add unistd.
* modules/canonicalize (Depends-on): Remove free-posix, xalloc.
Add unistd.

4 years agoscratch_buffer: Fix dependencies.
Bruno Haible [Sat, 30 Jan 2021 15:16:04 +0000 (16:16 +0100)]
scratch_buffer: Fix dependencies.

* modules/scratch_buffer (Depends-on): Add malloc-posix, realloc-posix,
free-posix.