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 e6905e4c82)
This commit is contained in:
Victor Stinner 2020-09-01 20:54:37 +02:00 committed by GitHub
parent c16a2a1b64
commit 4217b3c128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -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.