diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2020-09-18 13:04:27 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2020-09-18 13:04:27 +0300 |
commit | 154592f9db7af78cfa31ad6d64134ca89eed13b0 (patch) | |
tree | edcf45357d13c23d59e75bde7d513e856a4c71cf /support/verify.h | |
parent | cde8fd84a060bcae8a5960897ff2e2de576b2e08 (diff) | |
download | egawk-154592f9db7af78cfa31ad6d64134ca89eed13b0.tar.gz egawk-154592f9db7af78cfa31ad6d64134ca89eed13b0.tar.bz2 egawk-154592f9db7af78cfa31ad6d64134ca89eed13b0.zip |
Update support files from GNULIB.
Diffstat (limited to 'support/verify.h')
-rw-r--r-- | support/verify.h | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/support/verify.h b/support/verify.h index f1097612..fa1ed717 100644 --- a/support/verify.h +++ b/support/verify.h @@ -23,11 +23,15 @@ /* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC) works as per C11. This is supported by GCC 4.6.0 and later, in C - mode. + mode, and by clang (also in C++ mode). Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as - per C2X, and define _GL_HAVE_STATIC_ASSERT1 if static_assert (R) - works as per C++17. This is supported by GCC 9.1 and later. + per C2X. This is supported by GCC 9.1 and later, and by clang in + C++1z mode. + + Define _GL_HAVE_STATIC_ASSERT1 if static_assert (R) works as per + C++17. This is supported by GCC 9.1 and later, and by clang in + C++1z mode. Support compilers claiming conformance to the relevant standard, and also support GCC when not pedantic. If we were willing to slow @@ -35,7 +39,8 @@ since this affects only the quality of diagnostics, why bother? */ #ifndef __cplusplus # if (201112L <= __STDC_VERSION__ \ - || (!defined __STRICT_ANSI__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__))) + || (!defined __STRICT_ANSI__ \ + && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 4 <= __clang_major__))) # define _GL_HAVE__STATIC_ASSERT 1 # endif # if (202000L <= __STDC_VERSION__ \ @@ -43,7 +48,15 @@ # define _GL_HAVE__STATIC_ASSERT1 1 # endif #else -# if 201703L <= __cplusplus || 9 <= __GNUC__ +# if 4 <= __clang_major__ +# define _GL_HAVE__STATIC_ASSERT 1 +# endif +# if 4 <= __clang_major__ && 201411 <= __cpp_static_assert +# define _GL_HAVE__STATIC_ASSERT1 1 +# endif +# if 201703L <= __cplusplus \ + || 9 <= __GNUC__ \ + || (4 <= __clang_major__ && 201411 <= __cpp_static_assert) # define _GL_HAVE_STATIC_ASSERT1 1 # endif #endif @@ -292,7 +305,12 @@ 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 it breaks GNU Emacs master + as of 2020-08-23T21:09:49Z!eggert@cs.ucla.edu; see + <https://bugs.gnu.org/43152#71>. It's not known whether this breakage + is a Clang bug or an Emacs bug; play it safe for now. */ #if _GL_HAS_BUILTIN_UNREACHABLE # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) |