|
| 1 | +--- Include/pymacro.h-orig 2023-06-06 22:00:27.000000000 +0000 |
| 2 | ++++ Include/pymacro.h 2023-07-03 19:36:57.974496974 +0000 |
| 3 | +@@ -3,23 +3,20 @@ |
| 4 | + |
| 5 | + // gh-91782: On FreeBSD 12, if the _POSIX_C_SOURCE and _XOPEN_SOURCE macros are |
| 6 | + // defined, <sys/cdefs.h> disables C11 support and <assert.h> does not define |
| 7 | +-// the static_assert() macro. |
| 8 | ++// the static_assert() macro. Define the static_assert() macro in Python until |
| 9 | ++// <sys/cdefs.h> suports C11: |
| 10 | + // https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290 |
| 11 | +-// |
| 12 | +-// macOS <= 10.10 doesn't define static_assert in assert.h at all despite |
| 13 | +-// having C11 compiler support. |
| 14 | +-// |
| 15 | +-// static_assert is defined in glibc from version 2.16. Compiler support for |
| 16 | +-// the C11 _Static_assert keyword is in gcc >= 4.6. |
| 17 | +-// |
| 18 | +-// MSVC makes static_assert a keyword in C11-17, contrary to the standards. |
| 19 | +-// |
| 20 | +-// In C++11 and C2x, static_assert is a keyword, redefining is undefined |
| 21 | +-// behaviour. So only define if building as C (if __STDC_VERSION__ is defined), |
| 22 | +-// not C++, and only for C11-17. |
| 23 | +-#if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) \ |
| 24 | +- && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \ |
| 25 | +- && __STDC_VERSION__ <= 201710L |
| 26 | ++#if defined(__FreeBSD__) && !defined(static_assert) |
| 27 | ++# define static_assert _Static_assert |
| 28 | ++#endif |
| 29 | ++ |
| 30 | ++// static_assert is defined in glibc from version 2.16. Before it requires |
| 31 | ++// compiler support (gcc >= 4.6) and is called _Static_assert. |
| 32 | ++// In C++ 11 static_assert is a keyword, redefining is undefined behaviour. |
| 33 | ++#if (defined(__GLIBC__) \ |
| 34 | ++ && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) \ |
| 35 | ++ && !(defined(__cplusplus) && __cplusplus >= 201103L) \ |
| 36 | ++ && !defined(static_assert)) |
| 37 | + # define static_assert _Static_assert |
| 38 | + #endif |
| 39 | + |
0 commit comments