gh-91731: Add macro compatibility for static_assert for old libcs (GH-92559) (#92566)

(cherry picked from commit f0614ca980)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2022-05-09 12:35:42 -07:00 committed by GitHub
parent 1e4cdcf97f
commit 57ff4984e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,14 @@
# define static_assert _Static_assert
#endif
// static_assert is defined in GLIB from version 2.16. Before it requires
// compiler support (gcc >= 4.6) and is called _Static_assert.
#if (defined(__GLIBC__) \
&& (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) \
&& !defined(static_assert))
# define static_assert _Static_assert
#endif
/* Minimum value between x and y */
#define Py_MIN(x, y) (((x) > (y)) ? (y) : (x))