Commit 33b293b4 authored by Paul Eggert's avatar Paul Eggert

Update from Gnulib

This incorporates:
2020-08-06 libgmp: add <gmp/gmp.h> support
2020-08-06 Consider that clang defines __OPTIMIZE__ like GCC does
2020-08-06 Use __builtin_expect with clang everywhere
2020-08-05 Use __builtin_clz{,l,ll} with clang, also on Windows
2020-08-05 Use __builtin_ctz{,l,ll} and __builtin_ffs{,l,ll} with clang
2020-07-31 _GL_CMP: Improve documentation
2020-07-30 alloca, largefile: sync with Autoconf master
* lib/c++defs.h, lib/cdefs.h, lib/count-leading-zeros.h:
* lib/count-trailing-zeros.h, m4/alloca.m4, m4/gnulib-common.m4:
* m4/largefile.m4, m4/libgmp.m4:
Copy from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
parent 6cb6215c
Pipeline #6276 failed with stage
in 8 seconds
......@@ -268,7 +268,7 @@
_GL_CXXALIASWARN_2 (func, namespace)
/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
we enable the warning only when not optimizing. */
# if !__OPTIMIZE__
# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
# define _GL_CXXALIASWARN_2(func,namespace) \
_GL_WARN_ON_USE (func, \
"The symbol ::" #func " refers to the system function. " \
......@@ -296,7 +296,7 @@
_GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
/* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
we enable the warning only when not optimizing. */
# if !__OPTIMIZE__
# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
_GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
"The symbol ::" #func " refers to the system function. " \
......
......@@ -401,7 +401,7 @@
# endif
#endif
#if __GNUC__ >= 3
#if (__GNUC__ >= 3) || (__clang_major__ >= 4)
# define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
# define __glibc_likely(cond) __builtin_expect ((cond), 1)
#else
......
......@@ -38,7 +38,8 @@ extern "C" {
expand to code that computes the number of leading zeros of the local
variable 'x' of type TYPE (an unsigned integer type) and return it
from the current function. */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) \
|| (__clang_major__ >= 4)
# define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \
return x ? BUILTIN (x) : CHAR_BIT * sizeof x;
#elif _MSC_VER
......
......@@ -38,7 +38,8 @@ extern "C" {
expand to code that computes the number of trailing zeros of the local
variable 'x' of type TYPE (an unsigned integer type) and return it
from the current function. */
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) \
|| (__clang_major__ >= 4)
# define COUNT_TRAILING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \
return x ? BUILTIN (x) : CHAR_BIT * sizeof x;
#elif _MSC_VER
......
......@@ -246,9 +246,10 @@ GL_GENERATE_ALLOCA_H = @GL_GENERATE_ALLOCA_H@
GL_GENERATE_BYTESWAP_H = @GL_GENERATE_BYTESWAP_H@
GL_GENERATE_ERRNO_H = @GL_GENERATE_ERRNO_H@
GL_GENERATE_EXECINFO_H = @GL_GENERATE_EXECINFO_H@
GL_GENERATE_GMP_H = @GL_GENERATE_GMP_H@
GL_GENERATE_GMP_GMP_H = @GL_GENERATE_GMP_GMP_H@
GL_GENERATE_IEEE754_H = @GL_GENERATE_IEEE754_H@
GL_GENERATE_LIMITS_H = @GL_GENERATE_LIMITS_H@
GL_GENERATE_MINI_GMP_H = @GL_GENERATE_MINI_GMP_H@
GL_GENERATE_STDALIGN_H = @GL_GENERATE_STDALIGN_H@
GL_GENERATE_STDDEF_H = @GL_GENERATE_STDDEF_H@
GL_GENERATE_STDINT_H = @GL_GENERATE_STDINT_H@
......@@ -1085,7 +1086,6 @@ gamedir = @gamedir@
gamegroup = @gamegroup@
gameuser = @gameuser@
gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7 = @gl_GNULIB_ENABLED_03e0aaad4cb89ca757653bd367a6ccb7@
gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9 = @gl_GNULIB_ENABLED_2049e887c7e5308faad27b3f894bb8c9@
gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b = @gl_GNULIB_ENABLED_260941c0e5dc67ec9e87d1fb321c300b@
gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31 = @gl_GNULIB_ENABLED_5264294aa0a5557541b53c8c741f7f31@
gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c = @gl_GNULIB_ENABLED_6099e9737f757db36c47fa9d9f02e88c@
......@@ -2021,15 +2021,22 @@ ifeq (,$(OMIT_GNULIB_MODULE_libgmp))
BUILT_SOURCES += $(GMP_H)
ifneq (,$(GL_GENERATE_MINI_GMP_H))
# Build gmp.h as a wrapper for mini-gmp.h when using mini-gmp.
ifneq (,$(GL_GENERATE_GMP_H))
gmp.h: $(top_builddir)/config.status
echo '#include "mini-gmp.h"' >$@-t
mv $@-t $@
else
ifneq (,$(GL_GENERATE_GMP_GMP_H))
# Build gmp.h as a wrapper for gmp/gmp.h.
gmp.h: $(top_builddir)/config.status
echo '#include <gmp/gmp.h>' >$@-t
mv $@-t $@
else
gmp.h: $(top_builddir)/config.status
rm -f $@
endif
endif
MOSTLYCLEANFILES += gmp.h gmp.h-t
EXTRA_DIST += mini-gmp-gnulib.c mini-gmp.c mini-gmp.h
......
# alloca.m4 serial 16
# alloca.m4 serial 17
dnl Copyright (C) 2002-2004, 2006-2007, 2009-2020 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
......@@ -50,10 +50,13 @@ AC_DEFUN([gl_FUNC_ALLOCA],
# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
AC_DEFUN([gl_PREREQ_ALLOCA], [:])
# This works around a bug in autoconf <= 2.68.
# See <https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html> and
# <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=6cd9f12520b0d6f76d3230d7565feba1ecf29497>.
# Also it has a simplification that is not yet in Autoconf.
m4_version_prereq([2.70], [], [
# This works around a bug in autoconf <= 2.68 and has simplifications
# from 2.70. See:
# https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html
# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497
# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=15edf7fd8094fd14a89d9891dd72a9624762597a
# _AC_LIBOBJ_ALLOCA
# -----------------
......@@ -102,3 +105,4 @@ AH_VERBATIM([STACK_DIRECTION],
@%:@undef STACK_DIRECTION])dnl
AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
])
])
# gnulib-common.m4 serial 52
# gnulib-common.m4 serial 53
dnl Copyright (C) 2007-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -300,7 +300,9 @@ AC_DEFUN([gl_COMMON_BODY], [
#define _GL_ASYNC_SAFE
])
AH_VERBATIM([micro_optimizations],
[/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2.
[/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where
n1 and n2 are expressions without side effects, that evaluate to real
numbers (excluding NaN).
It returns
1 if n1 > n2
0 if n1 == n2
......
......@@ -346,7 +346,7 @@ AC_DEFUN([gl_INIT],
AC_REQUIRE([gl_LARGEFILE])
gl___INLINE
gl_LIBGMP
if test -n "$GMP_H"; then
if test $HAVE_LIBGMP != yes; then
AC_LIBOBJ([mini-gmp-gnulib])
fi
gl_LIMITS_H
......
......@@ -35,7 +35,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
@%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
@%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31))
int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1]];[]dnl
......
# libgmp.m4 serial 4
# libgmp.m4 serial 5
# Configure the GMP library or a replacement.
dnl Copyright 2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
......@@ -18,50 +18,54 @@ AC_DEFUN([gl_LIBGMP],
[AS_HELP_STRING([--without-libgmp],
[do not use the GNU Multiple Precision (GMP) library;
this is the default on systems lacking libgmp.])])
case "$with_libgmp" in
no)
HAVE_LIBGMP=no
LIBGMP=
LTLIBGMP=
;;
*)
dnl Prefer AC_LIB_HAVE_LINKFLAGS if the havelib module is also in use.
m4_ifdef([gl_HAVE_MODULE_HAVELIB],
[AC_LIB_HAVE_LINKFLAGS([gmp], [],
[#include <gmp.h>],
[static const mp_limb_t x[2] = { 0x73, 0x55 };
mpz_t tmp;
mpz_roinit_n (tmp, x, 2);
],
[no])],
[gl_saved_LIBS=$LIBS
AC_SEARCH_LIBS([__gmpz_roinit_n], [gmp])
LIBS=$gl_saved_LIBS
case $ac_cv_search___gmpz_roinit_n in
'none needed')
HAVE_LIBGMP=yes LIBGMP=;;
-*)
HAVE_LIBGMP=yes LIBGMP=$ac_cv_search___gmpz_roinit_n;;
*)
HAVE_LIBGMP=no LIBGMP=;;
esac
LTLIBGMP=$LIBGMP
AC_SUBST([HAVE_LIBGMP])
AC_SUBST([LIBGMP])
AC_SUBST([LTLIBGMP])])
if test "$with_libgmp,$HAVE_LIBGMP" = yes,no; then
AC_MSG_ERROR(
[GMP not found, although --with-libgmp was specified.m4_ifdef(
[AC_LIB_HAVE_LINKFLAGS],
[ Try specifying --with-libgmp-prefix=DIR.])])
fi
;;
esac
if test $HAVE_LIBGMP = yes; then
HAVE_LIBGMP=no
LIBGMP=
LTLIBGMP=
AS_IF([test "$with_libgmp" != no],
[AC_CHECK_HEADERS([gmp.h gmp/gmp.h], [break])
dnl Prefer AC_LIB_HAVE_LINKFLAGS if the havelib module is also in use.
AS_IF([test "$ac_cv_header_gmp_h" = yes ||
test "$ac_cv_header_gmp_gmp_h" = yes],
[m4_ifdef([gl_HAVE_MODULE_HAVELIB],
[AC_LIB_HAVE_LINKFLAGS([gmp], [],
[#if HAVE_GMP_H
# include <gmp.h>
#else
# include <gmp/gmp.h>
#endif],
[static const mp_limb_t x[2] = { 0x73, 0x55 };
mpz_t tmp;
mpz_roinit_n (tmp, x, 2);
],
[no])],
[gl_saved_LIBS=$LIBS
AC_SEARCH_LIBS([__gmpz_roinit_n], [gmp])
LIBS=$gl_saved_LIBS
case $ac_cv_search___gmpz_roinit_n in
'none needed')
HAVE_LIBGMP=yes;;
-*)
HAVE_LIBGMP=yes
LIBGMP=$ac_cv_search___gmpz_roinit_n
LTLIBGMP=$LIBGMP;;
esac
AC_SUBST([HAVE_LIBGMP])
AC_SUBST([LIBGMP])
AC_SUBST([LTLIBGMP])])])
if test "$with_libgmp,$HAVE_LIBGMP" = yes,no; then
AC_MSG_ERROR(
[GMP not found, although --with-libgmp was specified.m4_ifdef(
[AC_LIB_HAVE_LINKFLAGS],
[ Try specifying --with-libgmp-prefix=DIR.])])
fi])
if test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" = yes; then
GMP_H=
else
GMP_H=gmp.h
fi
AC_SUBST([GMP_H])
AM_CONDITIONAL([GL_GENERATE_GMP_H], [test -n "$GMP_H"])
AM_CONDITIONAL([GL_GENERATE_MINI_GMP_H],
[test $HAVE_LIBGMP != yes])
AM_CONDITIONAL([GL_GENERATE_GMP_GMP_H],
[test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" != yes])
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment