From: Victor Stinner Date: Thu, 21 Apr 2022 14:40:34 +0000 (+0200) Subject: gh-91782: Define static_assert() macro on FreeBSD (#91787) X-Git-Tag: v3.11.0b1~270 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1b184c84082530f35c593cb7728752e258371c30;p=thirdparty%2FPython%2Fcpython.git gh-91782: Define static_assert() macro on FreeBSD (#91787) On FreeBSD, if the static_assert() macro is not defined, define it in Python until supports C11: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290 --- diff --git a/Include/pymacro.h b/Include/pymacro.h index 2728496976de..71d6714afd11 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -1,6 +1,15 @@ #ifndef Py_PYMACRO_H #define Py_PYMACRO_H +// gh-91782: On FreeBSD 12, if the _POSIX_C_SOURCE and _XOPEN_SOURCE macros are +// defined, disables C11 support and does not define +// the static_assert() macro. Define the static_assert() macro in Python until +// suports C11: +// https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290 +#if defined(__FreeBSD__) && !defined(static_assert) +# define static_assert _Static_assert +#endif + /* Minimum value between x and y */ #define Py_MIN(x, y) (((x) > (y)) ? (y) : (x))