Skip to content

Commit f0614ca

Browse files
authored
gh-91731: Add macro compatibility for static_assert for old libcs (GH-92559)
1 parent e3fa60b commit f0614ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Include/pymacro.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
# define static_assert _Static_assert
1111
#endif
1212

13+
// static_assert is defined in GLIB from version 2.16. Before it requires
14+
// compiler support (gcc >= 4.6) and is called _Static_assert.
15+
#if (defined(__GLIBC__) \
16+
&& (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) \
17+
&& !defined(static_assert))
18+
# define static_assert _Static_assert
19+
#endif
20+
1321
/* Minimum value between x and y */
1422
#define Py_MIN(x, y) (((x) > (y)) ? (y) : (x))
1523

0 commit comments

Comments
 (0)