summaryrefslogtreecommitdiff
path: root/gettext-runtime
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-08-07 21:21:56 +0200
committerBruno Haible <bruno@clisp.org>2020-08-07 21:21:56 +0200
commitb8f214c7c9dee73d1053fe47894fb5a044f356ee (patch)
treeb1d1ece216e26068288dee5dde904209fd2f7299 /gettext-runtime
parentf7f911924c6d838b454f96ef220400a342b04dd7 (diff)
downloadgettext-b8f214c7c9dee73d1053fe47894fb5a044f356ee.tar.gz
Update after gnulib changed.
* gettext-runtime/intl/verify.h: Update from gnulib. * gettext-runtime/intl/vasnprintf.c: Likewise. * gettext-runtime/libasprintf/vasnprintf.c: Likewise.
Diffstat (limited to 'gettext-runtime')
-rw-r--r--gettext-runtime/intl/vasnprintf.c3
-rw-r--r--gettext-runtime/intl/verify.h11
-rw-r--r--gettext-runtime/libasprintf/vasnprintf.c3
3 files changed, 14 insertions, 3 deletions
diff --git a/gettext-runtime/intl/vasnprintf.c b/gettext-runtime/intl/vasnprintf.c
index 0ef77893c..079d6f174 100644
--- a/gettext-runtime/intl/vasnprintf.c
+++ b/gettext-runtime/intl/vasnprintf.c
@@ -633,7 +633,8 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
/* Determine s = GMP_LIMB_BITS - integer_length (msd).
Code copied from gnulib's integer_length.c. */
-# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) \
+ || (__clang_major__ >= 4)
s = __builtin_clz (msd);
# else
# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT
diff --git a/gettext-runtime/intl/verify.h b/gettext-runtime/intl/verify.h
index 11dc4bf7a..5efeed82d 100644
--- a/gettext-runtime/intl/verify.h
+++ b/gettext-runtime/intl/verify.h
@@ -233,6 +233,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
@@ -294,7 +301,9 @@ template <int w>
diagnostics, performance can suffer if R uses hard-to-optimize
features such as function calls not inlined by the compiler. */
-#if _GL_HAS_BUILTIN_UNREACHABLE
+#if _GL_HAS_BUILTIN_ASSUME
+# define assume(R) __builtin_assume (R)
+#elif _GL_HAS_BUILTIN_UNREACHABLE
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
#elif 1200 <= _MSC_VER
# define assume(R) __assume (R)
diff --git a/gettext-runtime/libasprintf/vasnprintf.c b/gettext-runtime/libasprintf/vasnprintf.c
index 0ef77893c..079d6f174 100644
--- a/gettext-runtime/libasprintf/vasnprintf.c
+++ b/gettext-runtime/libasprintf/vasnprintf.c
@@ -633,7 +633,8 @@ divide (mpn_t a, mpn_t b, mpn_t *q)
mp_limb_t msd = b_ptr[b_len - 1]; /* = b[n-1], > 0 */
/* Determine s = GMP_LIMB_BITS - integer_length (msd).
Code copied from gnulib's integer_length.c. */
-# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) \
+ || (__clang_major__ >= 4)
s = __builtin_clz (msd);
# else
# if defined DBL_EXPBIT0_WORD && defined DBL_EXPBIT0_BIT