Bruno Haible [Thu, 5 Dec 2019 02:18:42 +0000 (03:18 +0100)]
Fix compilation errors in C++ mode with xlclang++ on AIX.
* lib/math.in.h (expm1l, fmal, remainderl, roundl): Don't redeclare in
C++ mode on AIX.
(isfinite, signbit): In C++ mode on AIX with clang, use the approach
without C preprocessor macro.
* lib/pthread.in.h (pthread_exit): Use _GL_CXXALIAS_SYS_CAST instead of
_GL_CXXALIAS_SYS.
* lib/threads.in.h (thrd_exit): Likewise.
Bruno Haible [Tue, 3 Dec 2019 01:04:23 +0000 (02:04 +0100)]
Fix link errors with --enable-threads=posix on AIX.
* modules/string-c++-tests (Makefile.am): Link the test-string-c++
program with $(LIBTHREAD).
* modules/wchar-c++-tests (Makefile.am): Link the test-wchar-c++
program with $(LIBTHREAD).
Tim Rühsen [Sat, 30 Nov 2019 12:04:28 +0000 (13:04 +0100)]
gnulib-tool.py: Fix libgnu_la_LDFLAGS section in generated Makefile.am.
Reported by Dagobert Michelsen <dam@opencsw.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2019-11/msg00086.html>.
* pygnulib/GLModuleSystem.py (getLink): Don't join the parts. Return a
list of strings instead of one string.
* pygnulib/GLEmiter.py (lib_Makefile_am): Adapt accordingly.
* pygnulib/GLImport.py (execute): Likewise.
Bruno Haible [Wed, 27 Nov 2019 23:34:34 +0000 (00:34 +0100)]
openpty, forkpty: Fix build error on Solaris 11.4.
* m4/pty_h.m4 (gl_PTY_H): Test for termios.h. Look for the declarations
also in <termios.h>.
* m4/pty.m4 (gl_FUNC_FORKPTY, gl_FUNC_OPENPTY): Look for the declaration
of the function also in <termios.h>.
* doc/glibc-functions/openpty.texi: Mention the Solaris 11.4 problems.
* doc/glibc-functions/forkpty.texi: Likewise.
Bruno Haible [Wed, 27 Nov 2019 05:03:21 +0000 (06:03 +0100)]
New options --enable-threads=isoc and --enable-threads=isoc+posix.
* m4/threadlib.m4 (gl_THREADLIB_EARLY_BODY): Accept the options
--enable-threads=isoc and --enable-threads=isoc+posix.
(gl_THREADLIB_BODY): Test whether the ISO C threads API is available.
When both the ISO C and the POSIX threads API are available, choose
USE_ISOC_AND_POSIX_THREADS instead of USE_POSIX_THREADS if
--enable-threads=isoc+posix was specified. When only the ISO C threads
API is available and --enable-threads=iso was specified, choose
USE_ISOC_THREADS.
* lib/glthread/lock.h: Add new code for USE_ISOC_THREADS ||
USE_ISOC_AND_POSIX_THREADS.
* lib/glthread/lock.c: Likewise.
* lib/glthread/cond.h: Likewise.
* lib/glthread/cond.c: Likewise.
* lib/glthread/tls.h: Likewise.
* lib/glthread/tls.c: Likewise.
* lib/glthread/yield.h: Likewise.
* lib/glthread/thread.h: Add new code for USE_ISOC_THREADS. Treat
USE_ISOC_AND_POSIX_THREADS like USE_POSIX_THREADS.
* lib/glthread/thread.c: Likewise.
* lib/glthread/threadlib.c: Likewise.
* tests/test-lock.c: Save and restore the values of USE_ISOC_THREADS and
USE_ISOC_AND_POSIX_THREADS.
* tests/test-cond.c: Consider USE_ISOC_THREADS and
USE_ISOC_AND_POSIX_THREADS.
* tests/test-tls.c: Likewise.
* tests/test-thread_create.c (main): Likewise.
* tests/test-pthread-cond.c: Likewise.
* tests/test-pthread-mutex.c: Likewise.
* tests/test-pthread-once2.c: Likewise.
* tests/test-pthread-rwlock.c: Likewise.
* tests/test-pthread-tss.c: Likewise.
* tests/test-pthread_sigmask2.c: Treat USE_ISOC_AND_POSIX_THREADS like
USE_POSIX_THREADS.
Bruno Haible [Sun, 24 Nov 2019 19:31:50 +0000 (20:31 +0100)]
mbrtowc: Modernize autoconf test.
* m4/mbrtowc.m4 (gl_MBRTOWC_INCOMPLETE_STATE): Require
gt_LOCALE_FR_UTF8. If a traditional Japanese locale is not available,
try a UTF-8 locale.
* doc/posix-functions/mbrtowc.texi: Update info about AIX.
Bruno Haible [Sun, 24 Nov 2019 19:11:28 +0000 (20:11 +0100)]
sys_time: Fix errors in C++ mode on mingw.
* lib/sys_time.in.h (timeval): Restore the redirection
'#define timeval rpl_timeval', for when the symbol timeval is being used
outside the 'gnulib' namespace.
* lib/sys_select.in.h (select): In C++, write 'timeval', not
'struct timeval'.
Bruno Haible [Sun, 24 Nov 2019 19:10:56 +0000 (20:10 +0100)]
iswctype: Fix errors in C++ mode on mingw.
* lib/wctype.in.h (rpl_iswctype): Override if GNULIB_OVERRIDES_WINT_T
is 1.
* lib/iswctype.c (iswctype): Add another implementation, for the
GNULIB_defined_wint_t case.
* modules/iswctype (configure.ac): Compile iswctype.c also if
GNULIB_OVERRIDES_WINT_T is 1.
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".