summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-08-17 15:05:05 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-08-17 15:05:41 -0700
commit352b7dede0b3a28024a41a3da1c340859b110665 (patch)
tree19c558ffe9e8b973cff98bd548cc82fdebb2cd13 /lib
parenta1fe15a6ce7996504a2a422ac59f3494aa20819f (diff)
downloademacs-352b7dede0b3a28024a41a3da1c340859b110665.tar.gz
Update from Gnulib
This incorporates: 2020-08-17 verify: avoid __built_assume on Clang 2020-08-17 libc-config: avoid Clang’s __diagnose_if__ * lib/cdefs.h, lib/verify.h: Copy from Gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/cdefs.h2
-rw-r--r--lib/verify.h18
2 files changed, 8 insertions, 12 deletions
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 0cc27806a19..b1870fd0a93 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -148,7 +148,7 @@
# define __warnattr(msg) __attribute__((__warning__ (msg)))
# define __errordecl(name, msg) \
extern void name (void) __attribute__((__error__ (msg)))
-#elif __glibc_clang_has_attribute (__diagnose_if__)
+#elif __glibc_clang_has_attribute (__diagnose_if__) && 0 /* fails on Fedora 31 with Clang 9. */
# define __warndecl(name, msg) \
extern void name (void) __attribute__((__diagnose_if__ (1, msg, "warning")))
# define __warnattr(msg) __attribute__((__diagnose_if__ (1, msg, "warning")))
diff --git a/lib/verify.h b/lib/verify.h
index 0ba8d579071..d485a0283a9 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -246,13 +246,6 @@ 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
@@ -312,11 +305,14 @@ 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_ASSUME
-# define assume(R) __builtin_assume (R)
-#elif _GL_HAS_BUILTIN_UNREACHABLE
+#if _GL_HAS_BUILTIN_UNREACHABLE
# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ())
#elif 1200 <= _MSC_VER
# define assume(R) __assume (R)