|
25 | 25 |
|
26 | 26 |
|
27 | 27 | // _Py_ALIGN_AS: this compiler's spelling of `alignas` keyword, |
28 | | -// We currently use alignas for free-threaded builds only; additional compat |
29 | | -// checking would be great before we add it to the default build. |
| 28 | +// additional compat checking would be great since we added it to the default |
| 29 | +// build. |
30 | 30 | // Standards/compiler support: |
31 | 31 | // - `alignas` is a keyword in C23 and C++11. |
32 | 32 | // - `_Alignas` is a keyword in C11 |
|
38 | 38 | // unsupported platforms, we don't redefine _Py_ALIGN_AS if it's already |
39 | 39 | // defined. Note that defining it wrong (including defining it to nothing) will |
40 | 40 | // cause ABI incompatibilities. |
41 | | -#ifdef Py_GIL_DISABLED |
42 | | -# ifndef _Py_ALIGN_AS |
43 | | -# ifdef __cplusplus |
44 | | -# if __cplusplus >= 201103L |
45 | | -# define _Py_ALIGN_AS(V) alignas(V) |
46 | | -# elif defined(__GNUC__) || defined(__clang__) |
47 | | -# define _Py_ALIGN_AS(V) __attribute__((aligned(V))) |
48 | | -# elif defined(_MSC_VER) |
49 | | -# define _Py_ALIGN_AS(V) __declspec(align(V)) |
50 | | -# else |
51 | | -# define _Py_ALIGN_AS(V) alignas(V) |
52 | | -# endif |
53 | | -# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L |
54 | | -# define _Py_ALIGN_AS(V) alignas(V) |
55 | | -# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L |
56 | | -# define _Py_ALIGN_AS(V) _Alignas(V) |
57 | | -# elif (defined(__GNUC__) || defined(__clang__)) |
58 | | -# define _Py_ALIGN_AS(V) __attribute__((aligned(V))) |
59 | | -# elif defined(_MSC_VER) |
60 | | -# define _Py_ALIGN_AS(V) __declspec(align(V)) |
61 | | -# else |
62 | | -# define _Py_ALIGN_AS(V) _Alignas(V) |
63 | | -# endif |
64 | | -# endif |
| 41 | +#ifndef _Py_ALIGN_AS |
| 42 | +# ifdef __cplusplus |
| 43 | +# if __cplusplus >= 201103L |
| 44 | +# define _Py_ALIGN_AS(V) alignas(V) |
| 45 | +# elif defined(__GNUC__) || defined(__clang__) |
| 46 | +# define _Py_ALIGN_AS(V) __attribute__((aligned(V))) |
| 47 | +# elif defined(_MSC_VER) |
| 48 | +# define _Py_ALIGN_AS(V) __declspec(align(V)) |
| 49 | +# else |
| 50 | +# define _Py_ALIGN_AS(V) alignas(V) |
| 51 | +# endif |
| 52 | +# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L |
| 53 | +# define _Py_ALIGN_AS(V) alignas(V) |
| 54 | +# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L |
| 55 | +# define _Py_ALIGN_AS(V) _Alignas(V) |
| 56 | +# elif (defined(__GNUC__) || defined(__clang__)) |
| 57 | +# define _Py_ALIGN_AS(V) __attribute__((aligned(V))) |
| 58 | +# elif defined(_MSC_VER) |
| 59 | +# define _Py_ALIGN_AS(V) __declspec(align(V)) |
| 60 | +# else |
| 61 | +# define _Py_ALIGN_AS(V) _Alignas(V) |
| 62 | +# endif |
65 | 63 | #endif |
66 | 64 |
|
67 | 65 | /* Minimum value between x and y */ |
|
0 commit comments