Bruno Haible [Thu, 21 Nov 2019 10:44:05 +0000 (11:44 +0100)]
pthread-spin: Fix errors in C++ mode.
* m4/pthread-spin.m4 (gl_PTHREAD_SPIN): Mark the pthread_spin_*
functions as nonexistent when <pthread.h> exists but does not define
the pthread_spinlock_t type.
Bruno Haible [Thu, 21 Nov 2019 10:44:01 +0000 (11:44 +0100)]
pthread-mutex: Fix errors in C++ mode.
* m4/pthread-mutex.m4 (gl_PTHREAD_MUTEX): Test whether
pthread_mutexattr_getrobust exists. If not, define
PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
* lib/pthread-mutex.c (pthread_mutexattr_getrobust,
pthread_mutexattr_setrobust): Define also if <pthread.h> exists but
PTHREAD_MUTEXATTR_ROBUST_UNIMPLEMENTED.
* modules/pthread-mutex (configure.ac): Compile pthread-mutex.c also
when <pthread.h> exists but pthread_mutexattr_getrobust needs a gnulib
definition.
Paul Eggert [Tue, 19 Nov 2019 01:57:53 +0000 (17:57 -0800)]
glob: get closer to glibc glob.c
Omit differences from glibc when the differences don’t matter.
* lib/glob.c [_LIBC]: Include shlib-compat.h.
(__glob) [!_LIBC]: New macro. All uses of glob changed to __glob.
(glob_lstat): New function.
(glob_in_dir): Use it.
(GLOB_ATTRIBUTE): Define to empty if not already defined.
Use changed.
Bruno Haible [Mon, 18 Nov 2019 21:41:09 +0000 (22:41 +0100)]
stdint: Define [u]intptr_t correctly on 64-bit native Windows.
* lib/stdint.in.h (gl_intptr_t, gl_uintptr_t, INTPTR_MIN, INTPTR_MAX,
UINTPTR_MAX): Consider _WIN64.
* tests/test-stdint.c: Verify that [u]intptr_t is large enough to hold
a pointer.
* build-aux/vcs_to_changelog.py: New file.
* build-aux/vcstocl/frontend_c.py: New file.
* build-aux/vcstocl/misc_util.py: New file.
* build-aux/vcstocl/vcs_git.py: New file.
Bruno Haible [Mon, 18 Nov 2019 12:57:46 +0000 (13:57 +0100)]
stdint: Avoid triggering a "conflicting types" error on mingw 5.22.
Reported by Keith Marshall <keith@users.osdn.me> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-10/msg00044.html>
and <https://osdn.net/projects/mingw/ticket/39677>.
* lib/stdint.in.h (intptr_t, uintptr_t): Don't define if the types have
already been defined by mingw's <crtdefs.h>.
Bruno Haible [Mon, 18 Nov 2019 00:17:49 +0000 (01:17 +0100)]
locale, localename: Improve z/OS support.
Reported by Daniel Richard G. in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00001.html>.
* m4/locale_h.m4 (gl_LOCALE_T): New macro, partially extracted from
gl_LOCALE_H.
(gl_LOCALE_H): Require it.
* m4/localename.m4 (gl_LOCALENAME): Likewise. If locale_t is not
defined, don't even check for newlocale, duplocale, freelocale.
* m4/intl-thread-locale.m4 (gt_FUNC_USELOCALE): Make the test fail when
locale_t is not defined.
Bruno Haible [Sun, 17 Nov 2019 22:57:00 +0000 (23:57 +0100)]
havelib: Make libdirstems processing more flexible.
* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Set 3 libdirstem
variables: Consider 'lib' always, also on Solaris. Look for lib32 in
addition to lib64. Don't invoke /usr/bin/gcc (reverting the second
patch from 2017-02-19).
* m4/lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Consider up to 3 additional
libdirs, even when the first one exists as a directory.
Bruno Haible [Sun, 17 Nov 2019 22:56:55 +0000 (23:56 +0100)]
havelib: Match the bitness when searching for libraries.
* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Define a function
acl_is_expected_elfclass.
* m4/lib-link.m4 (AC_LIB_LINKFLAGS_BODY): When testing whether a library
file exists, in ELF, also test whether it has the ELF class that
corresponds to the host's bitness.
Bruno Haible [Sun, 17 Nov 2019 22:56:43 +0000 (23:56 +0100)]
havelib: Fix a bug in dependency processing.
* m4/lib-link.m4 (AC_LIB_LINKFLAGS_BODY): During dependency processing
of .la files, don't overwrite the value of additional_libdir for the
next rounds.
Bruno Haible [Sun, 17 Nov 2019 03:02:22 +0000 (04:02 +0100)]
wctype-h: When overriding wint_t, override also the related functions.
Reported by Christian Biesinger <cbiesinger@google.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00027.html>.
* m4/wctype_h.m4 (gl_WCTYPE_H): When GNULIB_OVERRIDES_WINT_T is 1, set
REPLACE_ISWCNTRL to 1.
* lib/wctype.in.h (rpl_iswalnum, rpl_iswalpha, rpl_iswblank,
rpl_iswcntrl, rpl_iswdigit, rpl_iswgraph, rpl_iswlower, rpl_iswprint,
rpl_iswpunct, rpl_iswspace, rpl_iswupper, rpl_iswxdigit, rpl_towlower,
rpl_towupper): New definitions when GNULIB_OVERRIDES_WINT_T is 1.
* doc/posix-headers/wchar.texi: Mention that wint_t is also overridden
on mingw.
* doc/posix-headers/wctype.texi: Likewise.
Bruno Haible [Sat, 16 Nov 2019 12:13:58 +0000 (13:13 +0100)]
time_r: Fix for mingw.
Reported by Christian Biesinger <cbiesinger@google.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00014.html>.
* lib/time.in.h: On mingw, include <unistd.h>.
* m4/time_r.m4 (gl_TIME_R): On mingw, include <unistd.h> before
<time.h>. Test for localtime_r in a way that works when it is defined
as an inline function.
Paul Eggert [Sat, 9 Nov 2019 20:02:24 +0000 (12:02 -0800)]
config: add msys support
Requested by Arnold Robbins in:
https://lists.gnu.org/r/bug-gnulib/2019-11/msg00008.html
He also requested a change to config.guess, which I’ll forward
upstream.
* build-aux/ar-lib (func_file_conv):
* build-aux/compile (func_file_conv):
* build-aux/config.rpath (wl, with_gnu_ld)
(hardcode_libdir_flag_spec, libext, shrext, library_names_spec):
Treat msys like cygwin.
Bruno Haible [Sun, 27 Oct 2019 14:34:25 +0000 (15:34 +0100)]
host-cpu-c-abi: Recognize i386 and a couple of other CPUs as 32-bit.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Include i386 in the case
statement.
(gl_HOST_CPU_C_ABI_32BIT): Likewise. Also recognize a couple of other
32-bit CPUs.
Paul Eggert [Fri, 25 Oct 2019 00:30:44 +0000 (17:30 -0700)]
timespec-add, timespec-sub: simplify
* lib/timespec-add.c (timespec_add):
* lib/timespec-sub.c (timespec_sub):
Simplify, now that INT_ADD_WRAPV and INT_SUBTRACT_WRAPV
work on unsigned integers.
Paul Eggert [Wed, 23 Oct 2019 20:33:37 +0000 (13:33 -0700)]
nstrftime: speed up integer overflow checking
* lib/nstrftime.c: Include intprops.h.
(INT_STRLEN_BOUND): Remove, as we can use intprops.h’s defn.
(__strftime_internal): Use INT_MULTIPLY_WRAPV and INT_ADD_WRAPV
instead of doing it by hand.
* modules/nstrftime (Depends-on): Add intprops.
Paul Eggert [Wed, 23 Oct 2019 20:31:15 +0000 (13:31 -0700)]
Port better to GCC under macOS
Work around macOS header that has ‘#define __has_builtin(x) 0’
when compiled by GCC. Apple really, really doesn’t want you to
use GCC, apparently. Rroblem reported by Akim Demaille in:
https://lists.gnu.org/r/bug-bison/2019-10/msg00071.html
The fix is to not trust __has_builtin when being compiled by
recent-enough GCC.
* lib/intprops.h (__has_builtin)
(_GL_HAS___builtin_add_overflow, _GL_TEMPDEF___has_builtin):
* lib/verify.h (__has_builtin, _GL_HAS___builtin_unreachable)
(_GL_HAS___builtin_trap, _GL_TEMPDEF___has_builtin):
Remove. All uses removed.
* lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW): Use __has_builtin
directly, if defined and if not newer GCC.
* lib/verify.h (_GL_HAS_BUILTIN_TRAP, _GL_HAS_BUILTIN_UNREACHABLE):
New macro, that use __has_builtin directly, if defined and if
not newer GCC.
(assume): Use them.
Akim Demaille [Mon, 21 Oct 2019 14:47:00 +0000 (16:47 +0200)]
bitset: let freeing functions accept NULL
* lib/bitset.c (bitset_free, bitset_obstack_free): Do nothing if
given NULL.
* lib/bitset.h: Document that.
* doc/bitset.texi: Fix the example, and demonstrate bitset_free.
Paul Eggert [Tue, 15 Oct 2019 19:48:54 +0000 (12:48 -0700)]
inttypes: use more-robust test for int range
This fixes Bison 3.4.2 when built with Oracle Solaris Studio 12.3.
Problem reported by Dagobert Michelsen in:
https://lists.gnu.org/r/bug-gnulib/2019-10/msg00042.html
* lib/inttypes.in.h: Rely only on limits.h when checking
int range.
Paul Eggert [Mon, 14 Oct 2019 20:36:44 +0000 (13:36 -0700)]
update-copyright: use en dashes in .texi ranges * build-aux/update-copyright: Update ranges in .tex, .texi, and .texinfo files to use en dashes instead of hyphens.
Paul Eggert [Fri, 11 Oct 2019 19:43:21 +0000 (12:43 -0700)]
Simplify and regularize regex use of ‘assert’
Also, tell GCC about the asserts even when compiling without
debugging, to give it further optimization opportunities.
* lib/regex_internal.h (DEBUG_ASSERT): New macro.
* lib/regcomp.c (link_nfa_nodes, calc_eclosure)
(parse_expression, parse_bracket_exp):
* lib/regex_internal.c (build_wcs_buffer)
(build_wcs_upper_buffer, re_string_reconstruct)
(re_string_context_at):
* lib/regexec.c (re_search_stub, re_copy_regs)
(re_search_internal, prune_impossible_nodes, check_matching)
(check_halt_state_context, set_regs, sift_states_backward)
(build_sifted_states, transit_state_mb, transit_state_bkref)
(check_arrival_add_next_nodes, check_arrival_expand_ecl)
(match_ctx_add_subtop):
Use it instead of plain ‘assert’.
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.