From: Victor Stinner Date: Tue, 1 Sep 2020 18:54:37 +0000 (+0200) Subject: bpo-41617: Fix pycore_byteswap.h to support clang 3.0 (GH-22042) (GH-22044) X-Git-Tag: v3.9.0rc2~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4217b3c12809b070928413f75949a7ddc4f2221c;p=thirdparty%2FPython%2Fcpython.git bpo-41617: Fix pycore_byteswap.h to support clang 3.0 (GH-22042) (GH-22044) __builtin_bswap16() is not available in LLVM clang 3.0. (cherry picked from commit e6905e4c82cc05897dc1bf5ab2b5b94b2b043a7f) --- diff --git a/Include/internal/pycore_byteswap.h b/Include/internal/pycore_byteswap.h index 5e64704a004c..975e150dd91b 100644 --- a/Include/internal/pycore_byteswap.h +++ b/Include/internal/pycore_byteswap.h @@ -15,10 +15,12 @@ extern "C" { # error "this header requires Py_BUILD_CORE define" #endif -#if defined(__clang__) || \ - (defined(__GNUC__) && \ - ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))) - /* __builtin_bswap16() is available since GCC 4.8, +#if ((defined(__GNUC__) \ + && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))) \ + || (defined(__clang__) \ + && (__clang_major__ >= 4 \ + || (__clang_major__ == 3 && __clang_minor__ >= 2)))) + /* __builtin_bswap16() is available since GCC 4.8 and clang 3.2, __builtin_bswap32() is available since GCC 4.3, __builtin_bswap64() is available since GCC 4.3. */ # define _PY_HAVE_BUILTIN_BSWAP diff --git a/Misc/NEWS.d/next/Build/2020-08-24-18-34-01.bpo-41617.sKKXz7.rst b/Misc/NEWS.d/next/Build/2020-08-24-18-34-01.bpo-41617.sKKXz7.rst new file mode 100644 index 000000000000..9e4bc60fd856 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2020-08-24-18-34-01.bpo-41617.sKKXz7.rst @@ -0,0 +1,2 @@ +Fix ``pycore_byteswap.h`` header file to support old clang versions: +``__builtin_bswap16()`` is not available in LLVM clang 3.0.