File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 2727// _Py_ALIGN_AS: this compiler's spelling of `alignas` keyword,
2828// We currently use alignas for free-threaded builds only; additional compat
2929// checking would be great before we add it to the default build.
30- // Standards support:
30+ // Standards/compiler support:
3131// - `alignas` is a keyword in C23 and C++11.
32- // - `_Alignas` is a keyword in C11.
32+ // - `_Alignas` is a keyword in C11, and a common C compiler extension
33+ // - GCC & clang has __attribute__((aligned))
3334// Older compilers may name it differently; to allow compilation on such
3435// unsupported platforms, we don't redefine _Py_ALIGN_AS if it's already
3536// defined. Note that defining it wrong (including defining it to nothing) will
3637// cause ABI incompatibilities.
3738#ifdef Py_GIL_DISABLED
3839# ifndef _Py_ALIGN_AS
3940# ifdef __cplusplus
40- # define _Py_ALIGN_AS (V ) alignas (V)
41+ # if (__cplusplus < 201103L) && (defined(__GNUC__) || defined(__clang__)
42+ # define _Py_ALIGN_AS (V ) __attribute__((aligned(V)))
43+ # else
44+ # define _Py_ALIGN_AS (V ) alignas (V)
45+ # endif
4146# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
4247# define _Py_ALIGN_AS (V ) alignas (V)
4348# else
You can’t perform that action at this time.
0 commit comments