]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41617: Fix pycore_bitutils.h to support clang 3.0 (GH-22042)
authorVictor Stinner <vstinner@python.org>
Tue, 1 Sep 2020 16:25:14 +0000 (18:25 +0200)
committerGitHub <noreply@github.com>
Tue, 1 Sep 2020 16:25:14 +0000 (18:25 +0200)
__builtin_bswap16() is not available in LLVM clang 3.0.

Include/internal/pycore_bitutils.h
Misc/NEWS.d/next/Build/2020-08-24-18-34-01.bpo-41617.sKKXz7.rst [new file with mode: 0644]

index 0bd3270fe82e5cbf26bb78f650e8466bf2746abf..1602fc68d94074dd3c1fde93e1e906dd4dab6a40 100644 (file)
@@ -17,10 +17,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 (file)
index 0000000..715eadb
--- /dev/null
@@ -0,0 +1,2 @@
+Fix ``pycore_bitutils.h`` header file to support old clang versions:
+``__builtin_bswap16()`` is not available in LLVM clang 3.0.