Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Include/pyport.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,15 @@ extern "C" {
* Usage:
* int _Py_HOT_FUNCTION x(void) { return 3; }
*
* Issue #28618: This attribute must not be abused, otherwise it can have a
* Issue gh-72804: This attribute must not be abused, otherwise it can have a
* negative effect on performance. Only the functions were Python spend most of
* its time must use it. Use a profiler when running performance benchmark
* suite to find these functions.
*/
#if defined(__GNUC__) \
&& ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))
#define _Py_HOT_FUNCTION __attribute__((hot))
#if _Py__has_attribute(hot)
# define _Py_HOT_FUNCTION __attribute__((hot))
#else
#define _Py_HOT_FUNCTION
# define _Py_HOT_FUNCTION
#endif

// Ask the compiler to always inline a static inline function. The compiler can
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable the use of ``__attribute__((hot))`` when building CPython with Clang and other compilers that support it.
Loading