Paul Eggert [Thu, 10 Oct 2019 00:37:37 +0000 (17:37 -0700)]
regex: tell compiler there’s at most 256 arcs out
Partly this is to help the reader (and maybe help GCC);
partly this is to pacify Coverity.
* lib/regex_internal.h: Include verify.h.
* lib/regexec.c (group_nodes_into_DFAstates):
Tell the compiler that ndests cannot exceed SBC_MAX.
* modules/regex (Depends-on): Add ‘verify’.
Paul Eggert [Thu, 10 Oct 2019 00:33:58 +0000 (17:33 -0700)]
regex: simplify by assuming C99
* config/srclist.txt: Comment out regex_internal.h and regexec.c
temporarily.
* lib/regex_internal.h (lock_define, re_match_context_t):
Simplify by assuming C99 macros and const.
* lib/regexec.c (re_search_internal): Simplify by assuming C99
initializers. Remove unnecessary assignment, as mctx is now
safely initialized earlier.
Paul Eggert [Thu, 10 Oct 2019 00:30:11 +0000 (17:30 -0700)]
regex: avoid copying of uninitialized storage
* config/srclist.txt: Comment out regcomp.c temporarily.
* lib/regcomp.c (build_charclass_op, create_tree) [! (GCC_LINT||lint)]:
Initialize even when not checking for lint, as the behavior is
arguably undefined otherwise and Coverity warns about it.
Bruno Haible [Sun, 6 Oct 2019 23:42:11 +0000 (01:42 +0200)]
access tests: Fix test failure when run as root.
* tests/test-access.c: Include root-uid.h.
(geteuid): Define fallback.
(main): Don't expect that writing to a read-only file would fail when
running as root. Also, remove the created files at the end.
* modules/access-tests (Depends-on): Add root-uid.
(configure.ac): Test whether geteuid exists.
Paul Eggert [Sun, 6 Oct 2019 04:36:15 +0000 (21:36 -0700)]
bootstrap: simplify debugging of wget failures
Problem reported by Tim Rühsen in:
https://lists.gnu.org/r/bug-gnulib/2019-10/msg00000.html
* build-aux/bootstrap (po_download_command_format):
Invoke wget with -nv instead of -q, to make debugging easier.
Paul Eggert [Mon, 23 Sep 2019 06:23:20 +0000 (23:23 -0700)]
Update some URLs
This is a clerical change that mostly changes http: to https: in URLs
where either will work. It also updates some URLs that have moved,
removes some URLs that no longer work, and fixes related text.
Paul Smith [Sun, 15 Sep 2019 17:47:43 +0000 (19:47 +0200)]
findprog-in: Set errno when the search fails.
* lib/findprog-in.c: Include <errno.h>.
(find_in_given_path): Set errno before returning NULL.
* lib/findprog.h (find_in_given_path): Update comment accordingly.
Define the term "slash".
Bruno Haible [Sat, 14 Sep 2019 17:41:46 +0000 (19:41 +0200)]
Make autoconf tests work with -Werror=implicit-function-declaration.
* m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Include <wctype.h>, for
towupper() declaration.
* m4/ptsname.m4 (gl_FUNC_PTSNAME): Include <stdlib.h>, for ptsname()
declaration.
Bruno Haible [Sun, 8 Sep 2019 16:21:21 +0000 (18:21 +0200)]
findprog-in: New module.
Suggested by Paul Smith <psmith@gnu.org>.
* lib/findprog.h (find_in_given_path): New declaration.
* lib/findprog-in.c: New file, based on lib/findprog.c.
* m4/findprog-in.m4: New file, based on m4/findprog.m4.
* modules/findprog-in: New file.
Reported by 江 祖铭 (Zu-Ming Jiang).
With help from Paul Eggert.
https://lists.gnu.org/archive/html/bug-bison/2019-08/msg00016.html
* lib/bitset/table.c (tbitset_resize): When growing, use xrealloc
instead of realloc.
When shrinking, accept failures.
* lib/bitset/vector.c (vbitset_resize): Likewise.
Bruno Haible [Sat, 7 Sep 2019 14:56:52 +0000 (16:56 +0200)]
doc: Update for glibc 2.30.
* doc/glibc-functions/gettid.texi: New file.
* doc/glibc-functions/pthread_cond_clockwait.texi: New file.
* doc/glibc-functions/pthread_mutex_clocklock.texi: New file.
* doc/glibc-functions/pthread_rwlock_clockrdlock.texi: New file.
* doc/glibc-functions/pthread_rwlock_clockwrlock.texi: New file.
* doc/glibc-functions/sem_clockwait.texi: New file.
* doc/glibc-functions/tgkill.texi: New file.
* doc/glibc-functions/twalk_r.texi: New file.
* doc/gnulib.texi: Include them.
(Glibc semaphore.h): New section.
* doc/pastposix-functions/h_errno.texi: Update.
* doc/posix-functions/*.texi: Likewise.
Bruno Haible [Sun, 1 Sep 2019 15:34:03 +0000 (17:34 +0200)]
gitsub.sh: Add support for shallow-cloning of subdirectories.
* top/gitsub.sh (func_usage): Document allowed git options with
'git pull'.
(func_pull): Accept GIT_OPTIONS argument.
(pull): Parse git options before complaining about too many arguments.
Pass the git options to func_pull.
Bruno Haible [Wed, 28 Aug 2019 16:03:43 +0000 (18:03 +0200)]
isfinite, isinf, isnan, signbit: Fix error in C++ mode on mingw.
Reported by Martin Storsjö <martin@martin.st> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00075.html>.
* lib/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Add more arguments.
(isfinite, isinf, isnan, signbit): On platforms that use C++ include
files from GCC 6 or newer, use an override through '#define', because
the inline definitions in the platform's <cmath> cannot be overridden
in another way.
Bruno Haible [Wed, 28 Aug 2019 08:34:40 +0000 (10:34 +0200)]
isfinite, isinf, isnan, signbit: Fix error in C++ mode on mingw.
Reported by Martin Storsjö <martin@martin.st> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00075.html>.
* lib/math.in.h (_GL_MATH_CXX_REAL_FLOATING_DECL_2): Add more arguments.
(isfinite, isinf, isnan, signbit): On mingw, use an override through
'#define', because the inline definitions in the platform's <cmath>
cannot be overridden in another way.
Paul Eggert [Wed, 28 Aug 2019 01:04:03 +0000 (18:04 -0700)]
Revert macOS INT_MULTIPLY_WRAPV patch
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00076.html
* lib/intprops.h (_GL_HAS___builtin_mul_overflow): Remove.
(_GL_HAS_BUILTIN_MUL_OVERFLOW):
Go back to working around the Clang bug on macOS.
Paul Eggert [Tue, 27 Aug 2019 11:23:44 +0000 (04:23 -0700)]
Speed up INT_MULTIPLY_WRAPV on macOS
Assume that __builtin_mul_overflow works OK with Clang on macOS.
Mattias Engdegård says it’s safe to assume the relevant library
is always available there.
* lib/intprops.h (_GL_HAS___builtin_mul_overflow):
New temporary internal macro.
(_GL_HAS_BUILTIN_MUL_OVERFLOW):
No need to work around the Clang bug on macOS.
Paul Eggert [Mon, 26 Aug 2019 02:29:15 +0000 (19:29 -0700)]
intprops.h, verify.h: port better to clang
Improve code generated by INT_ADD_WRAPV and INT_SUBTRACT_WRAPV
with Clang. Problem reported privately by Mattias Engdegård.
Also, insulate intprops.h and verify.h better against each other’s
definitions of __has_builtin on non-Clang hosts.
* lib/intprops.h (__has_builtin): Define a temporary substitute
if __has_builtin is not already defined.
(_GL_HAS___builtin_add_overflow, _GL_TEMPDEF___has_builtin):
New temporary internal macros.
(_GL_HAS_BUILTIN_ADD_OVERFLOW, _GL_HAS_BUILTIN_MUL_OVERFLOW):
Now two separate macros, replacing the old
_GL_HAS_BUILTIN_OVERFLOW, since we no longer assume that
__builtin_mul_overflow is like the rest. All uses changed.
(INT_ADD_WRAPV, INT_SUBTRACT_WRAPV, INT_MULTIPLY_WRAPV):
Adjust to above changes.
(_GL_INT_OP_WRAPV): Remove ‘builtin’ arg, since it’s no
longer relevant. All uses changed.
* lib/verify.h (__has_builtin): Treat like intprops.h,
so that the two .h files do not collide with each other.
(_GL_HAS___builtin_unreachable, _GL_HAS___builtin_trap)
(_GL_TEMPDEF___has_builtin): New temporary internal macros.
Bruno Haible [Sat, 24 Aug 2019 15:34:29 +0000 (17:34 +0200)]
crypto/gc-sha256, crypto/gc-sha512: New modules.
* lib/gc.h (gc_sha256, gc_sha512): New declarations.
* lib/gc-gnulib.c: Include sha256.h, sha512.h.
(MAX_DIGEST_SIZE): Set to 64.
(_gc_hash_ctx, gc_hash_open, gc_hash_digest_length, gc_hash_write,
gc_hash_read, gc_hash_buffer): Add support for sha256 and sha512.
(gc_sha256, gc_sha512): New functions.
* lib/gc-libgcrypt.c (gc_sha256, gc_sha512): New functions.
* modules/crypto/gc-sha256: New file, based on modules/crypto/gc-sha1.
* modules/crypto/gc-sha512: New file, based on modules/crypto/gc-sha1.
Bruno Haible [Sat, 24 Aug 2019 14:16:33 +0000 (16:16 +0200)]
crypto/gc-sm3: Fix compilation error with --with-libgcrypt.
* m4/gc-sm3.m4 (gl_GC_SM3): Test whether libgcrypt supports SM3. Define
LIBGCRYPT_HAS_MD_SM3.
* lib/gc-libgcrypt.c: Include sm3.h.
(_gc_hash_ctx, gc_hash_open, gc_hash_hmac_setkey, gc_hash_write,
gc_hash_read, gc_hash_close, gc_hash_buffer, gc_sm3): Use the gnulib
implementation if libgcrypt does not support SM3.
Bruno Haible [Sat, 24 Aug 2019 12:28:15 +0000 (14:28 +0200)]
crypto/gc-{md[24],rijndael} tests: Fix link error with --with-libgcrypt.
* modules/crypto/gc-md2-tests (test_gc_md2_LDADD): New variable.
* modules/crypto/gc-md4-tests (test_gc_md4_LDADD): New variable.
* modules/crypto/gc-rijndael-tests (test_gc_rijndael_LDADD): New
variable.
Bruno Haible [Sat, 24 Aug 2019 09:07:23 +0000 (11:07 +0200)]
gc: Fix configuration with --with-libgcrypt.
* m4/libgcrypt.m4: New file, copied from libgcrypt/src/libgcrypt.m4.
* modules/crypto/gc (Files): Add it.
* m4/gc.m4 (gl_GC): Assume AM_PATH_LIBGCRYPT is defined.
Eric Blake [Tue, 20 Aug 2019 16:34:34 +0000 (11:34 -0500)]
accept4: Support SOCK_NONBLOCK, if defined
Ideally, we would improve our replacement <sys/socket.h> to define a
replacement SOCK_NONBLOCK on all platforms, and teach socket() to
honor it as well; but that's a bigger task. In the meantime, if the
platform already has SOCK_NONBLOCK, we should honor it when doing a
fallback.
* lib/accept4.c (accept4): If SOCK_NONBLOCK is defined, honor it.
Eric Blake [Tue, 20 Aug 2019 16:26:17 +0000 (11:26 -0500)]
accept4: Fix compilation when native accept4() exists.
Reported by Richard W.M. Jones <rjones@redhat.com> in
https://lists.gnu.org/archive/html/bug-gnulib/2019-08/msg00029.html
* lib/accept4.c (accept4): Match witness symbol to m4 file update.
Paul Eggert [Thu, 15 Aug 2019 05:24:49 +0000 (22:24 -0700)]
intprops: support uchar, ushort _WRAPV dests
* lib/intprops.h (_GL_INT_OP_WRAPV_SMALLISH): New macro, defined
when __builtin_add_overflow etc. and _Generic are not used.
(_GL_INT_OP_WRAPV): Use it to support destinations that
are unsigned char or unsigned short, even in compilers
that lack __typeof__ and are not C11-compatible.
Paul Eggert [Thu, 15 Aug 2019 01:05:57 +0000 (18:05 -0700)]
intprops: pacify picky GCC
* lib/intprops.h (_GL_BUILTIN_MUL_OVERFLOW):
Pacify GCC’s complaints about ignoring __builtin_mul_overflow’s
possibly-incorrect result.
(_GL_INT_MULTIPLY_RANGE_OVERFLOW): Pacify GCC’s complaints
about (A) used as a boolean, when A is an expression like 3 * 4.
Paul Eggert [Thu, 15 Aug 2019 00:43:46 +0000 (17:43 -0700)]
intprops: support unsigned *_WRAPV results
Add support for unsigned, unsigned long, and unsigned long long
results to INT_ADD_WRAPV, INT_SUBTRACT_WRAPV, and
INT_MULTIPLY_WRAPV. Also, work around GCC bug 91450, and fix a
bug with unsigned inputs reported by Eli Zaretskii in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00012.html
* config/srclist.txt: Break the glibc connection for intprops.h
temporarily, while more testing is done in Gnulib-using apps.
* lib/intprops.h (INT_ADD_WRAPV, INT_SUBTRACT_WRAPV)
(INT_MULTIPLY_WRAPV, _GL_INT_OP_WRAPV, _GL_INT_OP_WRAPV_LONGISH):
Support unsigned results no narrower than unsigned int. Report
overflow correctly if some arguments are unsigned.
(_GL_BUILTIN_MUL_OVERFLOW): New macro, to work around GCC bug 91450.
(_GL_INT_OP_CALC): Simplify now that the OVERFLOW argument does
the right thing with narrow args.
(_GL_INT_OP_CALC1): Remove. All callers removed.
(_GL_INT_ADD_RANGE_OVERFLOW, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
(_GL_INT_MULTIPLY_RANGE_OVERFLOW): New macros.
* tests/test-intprops.c: Check for bugs and test new behavior.
Paul Eggert [Mon, 12 Aug 2019 21:57:08 +0000 (14:57 -0700)]
verify: improve diagnostic quality in recent GCC
If ‘verify’ fails in a deeply-nested macro, GCC does not output a
useful line number containing the top-level caller of the macro.
So, bring back the older way of issuing a diagnostic containing
the top-level call’s arg, so that it is easier to diagnose
‘verify’ failures with recent GCC.
* lib/verify.h (_GL_VERIFY_TRUE, _GL_VERIFY_TYPE):
Bring back DIAGNOSTIC arg. All callers changed.
(verify): Just use _GL_VERIFY.
Assaf Gordon [Sat, 10 Aug 2019 19:17:49 +0000 (13:17 -0600)]
parse-datetime: fix 'T' military timezone handling
* lib/parse-datetime.y (zone):
follow-up to the previous commit: the 'T' case is handled outside the
conversion table (used as either military timezone UTC-7 or ISO8601
separator). Change it from "HOUR(7)" to "-HOUR(7)" to match other
timezone letters.
Paul Eggert [Fri, 9 Aug 2019 20:47:41 +0000 (13:47 -0700)]
parse-datetime: fix military timezone letters
Problem and trivial fix reported by Neil Hoggarth in:
https://lists.gnu.org/r/bug-gnulib/2019-08/msg00005.html
* lib/parse-datetime.y (military_table):
Do it the right way, not the RFC 822 way.
Eric Blake [Thu, 8 Aug 2019 03:03:31 +0000 (22:03 -0500)]
configmake: Avoid namespace pollution issue on mingw.
Mingw includes a header that declares an enum typedef named DATADIR,
pulled in when including <winsock2.h>; compilation fails if DATADIR
has already been defined as a macro expanding to a string prior to
that inclusion. Although the configmake module documents that it
should generally be included only after system headers, it is just as
easy to make configmake.h robust to this particular issue by including
the system header first if it exists.
* modules/configmake (Makefile.am): If the project uses
<winsock2.h>, include that header before defining DATADIR.
Reported by libvirt: https://lists.gnu.org/archive/html/bug-gnulib/2019-07/msg00089.html
Bruno Haible [Thu, 25 Jul 2019 01:19:53 +0000 (03:19 +0200)]
pthread-h: Fix definitions of types and macros on mingw.
* lib/pthread.in.h (pthread_t, pthread_attr_t, PTHREAD_CREATE_JOINABLE,
PTHREAD_CREATE_DETACHED): Define also when module 'pthread-thread' is
not in use.
(pthread_once_t, PTHREAD_ONCE_INIT): Define also when module
'pthread-once' is not in use.
(pthread_mutex_t, pthread_mutexattr_t, PTHREAD_MUTEX_INITIALIZER,
PTHREAD_MUTEX_DEFAULT, PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK,
PTHREAD_MUTEX_RECURSIVE): Define also when module 'pthread-mutex' is not
in use.
(pthread_rwlock_t, pthread_rwlockattr_t, PTHREAD_RWLOCK_INITIALIZER):
Define also when module 'pthread-rwlock' is not in use.
(pthread_cond_t, pthread_condattr_t, PTHREAD_COND_INITIALIZER): Define
also when module 'pthread-cond' is not in use.
(pthread_key_t, PTHREAD_DESTRUCTOR_ITERATIONS): Define also when module
'pthread-tss' is not in use.
(pthread_spinlock_t): Define also when module 'pthread-spin' is not in
use.
Bruno Haible [Fri, 19 Jul 2019 03:00:10 +0000 (05:00 +0200)]
parse-datetime: Require Bison 2.4 or newer.
* m4/parse-datetime.m4 (gl_PARSE_DATETIME): Set PARSE_DATETIME_BISON.
Code taken from gettext's intl.m4.
* modules/parse-datetime (Makefile.am): Use PARSE_DATETIME_BISON instead
of YACC.