Skip to content

Commit e6905e4

Browse files
authored
bpo-41617: Fix pycore_bitutils.h to support clang 3.0 (GH-22042)
__builtin_bswap16() is not available in LLVM clang 3.0.
1 parent 0d6aa7f commit e6905e4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Include/internal/pycore_bitutils.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ extern "C" {
1717
# error "this header requires Py_BUILD_CORE define"
1818
#endif
1919

20-
#if defined(__clang__) || \
21-
(defined(__GNUC__) && \
22-
((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)))
23-
/* __builtin_bswap16() is available since GCC 4.8,
20+
#if ((defined(__GNUC__) \
21+
&& ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 8))) \
22+
|| (defined(__clang__) \
23+
&& (__clang_major__ >= 4 \
24+
|| (__clang_major__ == 3 && __clang_minor__ >= 2))))
25+
/* __builtin_bswap16() is available since GCC 4.8 and clang 3.2,
2426
__builtin_bswap32() is available since GCC 4.3,
2527
__builtin_bswap64() is available since GCC 4.3. */
2628
# define _PY_HAVE_BUILTIN_BSWAP
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix ``pycore_bitutils.h`` header file to support old clang versions:
2+
``__builtin_bswap16()`` is not available in LLVM clang 3.0.

0 commit comments

Comments
 (0)