8000 gh-91731: Add macro compatibility for static_assert for old libcs (GH… · python/cpython@57ff498 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57ff498

Browse files
gh-91731: Add macro compatibility for static_assert for old libcs (GH-92559) (#92566)
(cherry picked from commit f0614ca) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
1 parent 1e4cdcf commit 57ff498

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)
0