Update from Gnulib
This incorporates: 2020-08-23 intprops: be consistent about +X vs X+0 2020-08-23 intprops: fix INT_MULTIPLY_WRAPV bit-field bug 2020-08-23 verify: Make assume work on bit field expressions 2020-08-23 libc-config: Improve comments 2020-08-22 verify: Do use __builtin_assume on clang 2020-08-22 sig2str: Add more signals 2020-08-21 sigdescr_np: New module * lib/cdefs.h, lib/intprops.h, lib/sig2str.c, lib/string.in.h: * lib/verify.h, m4/string_h.m4: Copy from Gnulib. * lib/gnulib.mk.in: Regenerate.
This commit is contained in:
parent
2c389455c7
commit
42ec412515
7 changed files with 83 additions and 17 deletions
|
@ -148,7 +148,11 @@
|
|||
# define __warnattr(msg) __attribute__((__warning__ (msg)))
|
||||
# define __errordecl(name, msg) \
|
||||
extern void name (void) __attribute__((__error__ (msg)))
|
||||
#elif __glibc_clang_has_attribute (__diagnose_if__) && 0 /* fails on Fedora 31 with Clang 9. */
|
||||
#elif __glibc_clang_has_attribute (__diagnose_if__) && 0
|
||||
/* These definitions are not enabled, because they produce bogus warnings
|
||||
in the glibc Fortify functions. These functions are written in a style
|
||||
that works with GCC. In order to work with clang, these functions would
|
||||
need to be modified. */
|
||||
# define __warndecl(name, msg) \
|
||||
extern void name (void) __attribute__((__diagnose_if__ (1, msg, "warning")))
|
||||
# define __warnattr(msg) __attribute__((__diagnose_if__ (1, msg, "warning")))
|
||||
|
|
|
@ -426,6 +426,7 @@ GNULIB_SETENV = @GNULIB_SETENV@
|
|||
GNULIB_SETHOSTNAME = @GNULIB_SETHOSTNAME@
|
||||
GNULIB_SIGABBREV_NP = @GNULIB_SIGABBREV_NP@
|
||||
GNULIB_SIGACTION = @GNULIB_SIGACTION@
|
||||
GNULIB_SIGDESCR_NP = @GNULIB_SIGDESCR_NP@
|
||||
GNULIB_SIGNAL_H_SIGPIPE = @GNULIB_SIGNAL_H_SIGPIPE@
|
||||
GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@
|
||||
GNULIB_SLEEP = @GNULIB_SLEEP@
|
||||
|
@ -647,6 +648,7 @@ HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
|
|||
HAVE_SETSTATE = @HAVE_SETSTATE@
|
||||
HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@
|
||||
HAVE_SIGACTION = @HAVE_SIGACTION@
|
||||
HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@
|
||||
HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@
|
||||
HAVE_SIGINFO_T = @HAVE_SIGINFO_T@
|
||||
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
|
||||
|
@ -2846,6 +2848,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||
-e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \
|
||||
-e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \
|
||||
-e 's/@''GNULIB_SIGABBREV_NP''@/$(GNULIB_SIGABBREV_NP)/g' \
|
||||
-e 's/@''GNULIB_SIGDESCR_NP''@/$(GNULIB_SIGDESCR_NP)/g' \
|
||||
-e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \
|
||||
-e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \
|
||||
< $(srcdir)/string.in.h | \
|
||||
|
@ -2869,6 +2872,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
|
||||
-e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
|
||||
-e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \
|
||||
-e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \
|
||||
-e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
|
||||
-e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
|
||||
-e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
/* Minimum and maximum values for integer types and expressions. */
|
||||
|
||||
/* The width in bits of the integer type or expression T.
|
||||
Do not evaluate T.
|
||||
Do not evaluate T. T must not be a bit-field expression.
|
||||
Padding bits are not supported; this is checked at compile-time below. */
|
||||
#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT)
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
? _GL_SIGNED_INT_MAXIMUM (e) \
|
||||
: _GL_INT_NEGATE_CONVERT (e, 1))
|
||||
#define _GL_SIGNED_INT_MAXIMUM(e) \
|
||||
(((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH ((e) + 0) - 2)) - 1) * 2 + 1)
|
||||
(((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH (+ (e)) - 2)) - 1) * 2 + 1)
|
||||
|
||||
/* Work around OpenVMS incompatibility with C99. */
|
||||
#if !defined LLONG_MAX && defined __INT64_MAX
|
||||
|
@ -95,8 +95,9 @@
|
|||
#endif
|
||||
|
||||
/* Return 1 if the integer type or expression T might be signed. Return 0
|
||||
if it is definitely unsigned. This macro does not evaluate its argument,
|
||||
and expands to an integer constant expression. */
|
||||
if it is definitely unsigned. T must not be a bit-field expression.
|
||||
This macro does not evaluate its argument, and expands to an
|
||||
integer constant expression. */
|
||||
#if _GL_HAVE___TYPEOF__
|
||||
# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t))
|
||||
#else
|
||||
|
@ -109,6 +110,8 @@
|
|||
#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485)
|
||||
|
||||
/* Bound on length of the string representing an integer type or expression T.
|
||||
T must not be a bit-field expression.
|
||||
|
||||
Subtract 1 for the sign bit if T is signed, and then add 1 more for
|
||||
a minus sign if needed.
|
||||
|
||||
|
@ -120,7 +123,7 @@
|
|||
+ _GL_SIGNED_TYPE_OR_EXPR (t))
|
||||
|
||||
/* Bound on buffer size needed to represent an integer type or expression T,
|
||||
including the terminating null. */
|
||||
including the terminating null. T must not be a bit-field expression. */
|
||||
#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)
|
||||
|
||||
|
||||
|
@ -566,7 +569,7 @@
|
|||
? (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \
|
||||
? (a) < (tmax) / (b) \
|
||||
: ((INT_NEGATE_OVERFLOW (b) \
|
||||
? _GL_INT_CONVERT (b, tmax) >> (TYPE_WIDTH (b) - 1) \
|
||||
? _GL_INT_CONVERT (b, tmax) >> (TYPE_WIDTH (+ (b)) - 1) \
|
||||
: (tmax) / -(b)) \
|
||||
<= -1 - (a))) \
|
||||
: INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \
|
||||
|
|
|
@ -189,6 +189,11 @@ static struct numname { int num; char const name[8]; } numname_table[] =
|
|||
NUMNAME (STKFLT),
|
||||
#endif
|
||||
|
||||
/* AIX 7. */
|
||||
#ifdef SIGCPUFAIL
|
||||
NUMNAME (CPUFAIL),
|
||||
#endif
|
||||
|
||||
/* AIX 5L. */
|
||||
#ifdef SIGDANGER
|
||||
NUMNAME (DANGER),
|
||||
|
@ -229,7 +234,12 @@ static struct numname { int num; char const name[8]; } numname_table[] =
|
|||
NUMNAME (WINDOW), /* Older name for SIGWINCH. */
|
||||
#endif
|
||||
|
||||
/* BeOS */
|
||||
/* OpenBSD. */
|
||||
#ifdef SIGTHR
|
||||
NUMNAME (THR),
|
||||
#endif
|
||||
|
||||
/* BeOS, Haiku */
|
||||
#ifdef SIGKILLTHR
|
||||
NUMNAME (KILLTHR),
|
||||
#endif
|
||||
|
@ -239,6 +249,11 @@ static struct numname { int num; char const name[8]; } numname_table[] =
|
|||
NUMNAME (DIL),
|
||||
#endif
|
||||
|
||||
/* native Windows */
|
||||
#ifdef SIGBREAK
|
||||
NUMNAME (BREAK),
|
||||
#endif
|
||||
|
||||
/* Korn shell and Bash, of uncertain vintage. */
|
||||
{ 0, "EXIT" }
|
||||
};
|
||||
|
|
|
@ -1060,6 +1060,21 @@ _GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - "
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* Return an English description string for the signal number SIG. */
|
||||
#if @GNULIB_SIGDESCR_NP@
|
||||
# if ! @HAVE_SIGDESCR_NP@
|
||||
_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig));
|
||||
_GL_CXXALIASWARN (sigdescr_np);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef sigdescr_np
|
||||
# if HAVE_RAW_DECL_SIGDESCR_NP
|
||||
_GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - "
|
||||
"use gnulib module sigdescr_np for portability");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if @GNULIB_STRSIGNAL@
|
||||
# if @REPLACE_STRSIGNAL@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
|
|
37
lib/verify.h
37
lib/verify.h
|
@ -246,6 +246,13 @@ template <int w>
|
|||
|
||||
/* @assert.h omit start@ */
|
||||
|
||||
#if defined __has_builtin
|
||||
/* <https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions> */
|
||||
# define _GL_HAS_BUILTIN_ASSUME __has_builtin (__builtin_assume)
|
||||
#else
|
||||
# define _GL_HAS_BUILTIN_ASSUME 0
|
||||
#endif
|
||||
|
||||
#if 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__))
|
||||
# define _GL_HAS_BUILTIN_TRAP 1
|
||||
#elif defined __has_builtin
|
||||
|
@ -305,14 +312,30 @@ template <int w>
|
|||
|
||||
Although assuming R can help a compiler generate better code or
|
||||
diagnostics, performance can suffer if R uses hard-to-optimize
|
||||
features such as function calls not inlined by the compiler.
|
||||
features such as function calls not inlined by the compiler. */
|
||||
|
||||
Avoid Clang’s __builtin_assume, as clang 9.0.1 -Wassume can
|
||||
generate a bogus diagnostic "the argument to '__builtin_assume' has
|
||||
side effects that will be discarded" even when the argument has no
|
||||
side effects. */
|
||||
|
||||
#if _GL_HAS_BUILTIN_UNREACHABLE
|
||||
/* Use __builtin_assume in preference to __builtin_unreachable, because
|
||||
in clang versions 8.0.x and older, the definition based on
|
||||
__builtin_assume has an effect on optimizations, whereas the definition
|
||||
based on __builtin_unreachable does not. (GCC so far has only
|
||||
__builtin_unreachable.) */
|
||||
#if _GL_HAS_BUILTIN_ASSUME
|
||||
/* Use a temporary variable, to avoid a clang warning
|
||||
"the argument to '__builtin_assume' has side effects that will be discarded"
|
||||
if R contains invocations of functions not marked as 'const'.
|
||||
The type of the temporary variable can't be __typeof__ (R), because that
|
||||
does not work on bit field expressions. Use '_Bool' or 'bool' as type
|
||||
instead. */
|
||||
# if defined __cplusplus
|
||||
# define assume(R) \
|
||||
((void) ({ bool _gl_verify_temp = (R); \
|
||||
__builtin_assume (_gl_verify_temp); }))
|
||||
# else
|
||||
# define assume(R) \
|
||||
((void) ({ _Bool _gl_verify_temp = (R); \
|
||||
__builtin_assume (_gl_verify_temp); }))
|
||||
# endif
|
||||
#elif _GL_HAS_BUILTIN_UNREACHABLE
|
||||
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
|
||||
#elif 1200 <= _MSC_VER
|
||||
# define assume(R) __assume (R)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 25
|
||||
# serial 26
|
||||
|
||||
# Written by Paul Eggert.
|
||||
|
||||
|
@ -28,7 +28,7 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY],
|
|||
]],
|
||||
[ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul
|
||||
strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
|
||||
strerror_r sigabbrev_np strsignal strverscmp])
|
||||
strerror_r sigabbrev_np sigdescr_np strsignal strverscmp])
|
||||
|
||||
AC_REQUIRE([AC_C_RESTRICT])
|
||||
])
|
||||
|
@ -81,6 +81,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
|
|||
GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
|
||||
GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R])
|
||||
GNULIB_SIGABBREV_NP=0;AC_SUBST([GNULIB_SIGABBREV_NP])
|
||||
GNULIB_SIGDESCR_NP=0; AC_SUBST([GNULIB_SIGDESCR_NP])
|
||||
GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
|
||||
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
|
||||
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
|
||||
|
@ -104,6 +105,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
|
|||
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
|
||||
HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
|
||||
HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
|
||||
HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
|
||||
HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
|
||||
HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
|
||||
REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
|
||||
|
|
Loading…
Add table
Reference in a new issue