Skip to content

Commit 95d6e0b

Browse files
authored
pythonGH-131033: Enable the optimizing macros UNLIKELY and LIKELY for Clang (pythonGH-131019)
This includes clang-cl on Windows, which does not define the GCC version that was previously being checked.
1 parent 9ee0214 commit 95d6e0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/obmalloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,9 +1523,9 @@ PyObject_Free(void *ptr)
15231523
}
15241524

15251525

1526-
/* If we're using GCC, use __builtin_expect() to reduce overhead of
1526+
/* Use __builtin_expect() where available to reduce overhead of
15271527
the valgrind checks */
1528-
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
1528+
#if (defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 2))) && defined(__OPTIMIZE__)
15291529
# define UNLIKELY(value) __builtin_expect((value), 0)
15301530
# define LIKELY(value) __builtin_expect((value), 1)
15311531
#else

0 commit comments

Comments
 (0)