summaryrefslogtreecommitdiff
path: root/lib/compiler.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2021-02-21 05:48:48 +0100
committerDavid Lamparter <equinox@diac24.net>2021-03-17 06:18:17 +0100
commit15c05f1edf079bc03b277e44426a8af8616bb10b (patch)
tree07eba7a6ffc9e4c1caaabbb572632bd921082dc6 /lib/compiler.h
parent247c7e27a9928bd54e336590c526da68d4c79ff1 (diff)
*: require ISO C11 (or C++11)
It's 2021... time to drop some 10yo compat stuff. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/compiler.h')
-rw-r--r--lib/compiler.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/compiler.h b/lib/compiler.h
index 70ef8e9bc8..b5cfbefeb5 100644
--- a/lib/compiler.h
+++ b/lib/compiler.h
@@ -21,6 +21,21 @@
extern "C" {
#endif
+#ifdef __cplusplus
+# if __cplusplus < 201103L
+# error FRRouting headers must be compiled in C++11 mode or newer
+# endif
+/* C++ defines static_assert(), but not _Static_assert(). C defines
+ * _Static_assert() and has static_assert() in <assert.h>. However, we mess
+ * with assert() in zassert.h so let's not include <assert.h> here.
+ */
+# define _Static_assert static_assert
+#else
+# if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
+# error FRRouting must be compiled with min. -std=gnu11 (GNU ISO C11 dialect)
+# endif
+#endif
+
/* function attributes, use like
* void prototype(void) __attribute__((_CONSTRUCTOR(100)));
*/
@@ -357,10 +372,8 @@ typedef signed long long _int64_t;
/* if this breaks, 128-bit machines may have entered reality (or <long long>
* is something weird)
*/
-#if __STDC_VERSION__ >= 201112L
_Static_assert(sizeof(_uint64_t) == 8 && sizeof(_int64_t) == 8,
"nobody expects the spanish intquisition");
-#endif
/* since we redefined int64_t, we also need to redefine PRI*64 */
#undef PRIu64