Skip to content
Permalink
Browse files
gh-91731: Add macro compatibility for static_assert for old libcs (GH…
  • Loading branch information
pablogsal committed May 9, 2022
1 parent e3fa60b commit f0614ca9801d0768094570b784d2b26936bcca34
Showing 1 changed file with 8 additions and 0 deletions.
@@ -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))

0 comments on commit f0614ca

Please sign in to comment.