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.
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".
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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).
Paul Eggert [Sat, 23 Jan 2021 18:19:24 +0000 (10:19 -0800)]
libc-config: port to Xcode 7
Problem reported by Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2021-01/msg01089.html
* lib/cdefs.h (__nonnull): If already defined but glibc is not in
use, override the definition with Gnulib’s _GL_ATTRIBUTE_NONNULL.
This is needed for Xcode 7, which has a ‘#define __nonnull
_Nonnull’ builtin for backwards-compatibility with an older Xcode
syntax that GNUish code never uses.
Paul Eggert [Thu, 21 Jan 2021 21:40:16 +0000 (13:40 -0800)]
Port FALLTHROUGH to clang 3.4 and earlier
Problem reported by Akim Demaille in:
https://lists.gnu.org/r/bug-gnulib/2021-01/msg00241.html
* lib/cdefs.h (__glibc_has_attribute):
* m4/gnulib-common.m4 (gl_COMMON_BODY):
Do not trust __has_attribute in clang 3.4 and earlier, as
<https://releases.llvm.org/3.5.0/tools/clang/docs/ReleaseNotes.html>
says that __has_attribute is unreliable in these old versions.
Simon Josefsson [Wed, 20 Jan 2021 10:50:21 +0000 (11:50 +0100)]
gc-random: Replace implementation with call to getrandom.
* lib/gc-gnulib.c [GNULIB_GC_RANDOM]: Replace #include's with
those needed for getrandom.
(gc_init): Remove old randomness code.
(gc_done): Likewise.
(randomize): Rewrite using getrandom, inspired by getentropy.
* m4/gc-random.m4: Remove file.
* modules/crypto/gc-random: Drop gc-random.m4, gl_GC_RANDOM, and
LIB_GC_RANDOM. Add conditional dependency on getrandom.
* modules/crypto/gc-tests (test_gc_LDADD): Drop LIB_GC_RANDOM.
Bruno Haible [Wed, 20 Jan 2021 08:39:55 +0000 (09:39 +0100)]
exec*e tests: Avoid test failures on Cygwin.
* tests/test-execle-main.c (main): On Cygwin, add /bin to the new PATH.
* tests/test-execve-main.c (main): Likewise.
* tests/test-execvpe-main.c (main): Likewise.