summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/pymacro.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/Include/pymacro.h b/Include/pymacro.h
index 71d6714..5037bbd 100644
--- a/Include/pymacro.h
+++ b/Include/pymacro.h
@@ -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))