Skip to content

Commit 1b184c8

Browse files
authored
gh-91782: Define static_assert() macro on FreeBSD (#91787)
On FreeBSD, if the static_assert() macro is not defined, define it in Python until <sys/cdefs.h> supports C11: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290
1 parent 1a2b282 commit 1b184c8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Include/pymacro.h

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#ifndef Py_PYMACRO_H
22
#define Py_PYMACRO_H
33

4+
// gh-91782: On FreeBSD 12, if the _POSIX_C_SOURCE and _XOPEN_SOURCE macros are
5+
// defined, <sys/cdefs.h> disables C11 support and <assert.h> does not define
6+
// the static_assert() macro. Define the static_assert() macro in Python until
7+
// <sys/cdefs.h> suports C11:
8+
// https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255290
9+
#if defined(__FreeBSD__) && !defined(static_assert)
10+
# define static_assert _Static_assert
11+
#endif
12+
413
/* Minimum value between x and y */
514
#define Py_MIN(x, y) (((x) > (y)) ? (y) : (x))
615

0 commit comments

Comments
 (0)