Skip to content
Closed
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
26 changes: 26 additions & 0 deletions Include/pyport.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ extern "C" {
#elif defined(_MSC_VER)
#define Py_DEPRECATED(VERSION) __declspec(deprecated( \
"deprecated in " #VERSION))
#elif __STDC_VERSION__ >= 202311L || __cplusplus >= 201402L
#define Py_DEPRECATED(VERSION) [[deprecated("Deprecated in "#VERSION)]]
#else
#define Py_DEPRECATED(VERSION_UNUSED)
#endif
Expand Down Expand Up @@ -642,6 +644,30 @@ extern "C" {
# endif
#endif

#ifndef PY_CXX_CONSTEXPR
# if defined(__cplusplus) || __STDC_VERSION__ >= 202311L
# define PY_CXX_CONSTEXPR constexpr
# else
# define PY_CXX_CONSTEXPR
# endif
#endif

#ifndef PY_CXX_CONSTEVAL
# ifdef __cpp_consteval
# define PY_CXX_CONSTEVAL consteval
# else
# define PY_CXX_CONSTEVAL
# endif
#endif

#ifndef PY_CXX_CONSTINIT
# ifdef __cpp_constinit
# define PY_CXX_CONSTINIT constinit
# else
# define PY_CXX_CONSTINIT
# endif
#endif

#if defined(__sgi) && !defined(_SGI_MP_SOURCE)
# define _SGI_MP_SOURCE
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add macros for annotating functions with constexpr, consteval, and constinit
Loading