From f786ed830b83aa0edbca0b81478a7a70031594b4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 5 Feb 2015 15:52:20 -0800
Subject: [PATCH] Add ersatz _Static_assert on older hosts
* misc/sys/cdefs.h (_Static_assert): Define a substitute, if on a
pre-C11 pltform that is not known to support _Static_assert.
---
ChangeLog | 5 +++++
assert/assert.h | 1 -
misc/sys/cdefs.h | 8 ++++++++
3 files changed, 13 insertions(+), 1 deletion(-)
@@ -1,3 +1,8 @@
+2015-02-05 Paul Eggert <eggert@cs.ucla.edu>
+
+ * misc/sys/cdefs.h (_Static_assert): Define a substitute, if on a
+ pre-C11 platform that is not known to support _Static_assert.
+
2015-01-31 David S. Miller <davem@davemloft.net>
* sysdeps/sparc/sparc32/bits/atomic.h
@@ -113,7 +113,6 @@ __END_DECLS
#if defined __USE_ISOC11 && !defined __cplusplus
-/* Static assertion. Requires support in the compiler. */
# undef static_assert
# define static_assert _Static_assert
#endif
@@ -399,6 +399,14 @@
# endif
#endif
+#if (!defined _Static_assert \
+ && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
+ && (!__GNUC_PREREQ (4, 6) || defined __STRICT_ANSI__))
+# define _Static_assert(expr, diagnostic) \
+ extern int (*__Static_assert_function (void)) \
+ [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
+#endif
+
#include <bits/wordsize.h>
#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
--
2.1.0