aboutsummaryrefslogtreecommitdiff
path: root/lib/builtins/int_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/builtins/int_util.h')
-rw-r--r--lib/builtins/int_util.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/builtins/int_util.h b/lib/builtins/int_util.h
index a9b595db8d0f..a7b20ed66244 100644
--- a/lib/builtins/int_util.h
+++ b/lib/builtins/int_util.h
@@ -20,10 +20,14 @@
#define INT_UTIL_H
/** \brief Trigger a program abort (or panic for kernel code). */
-#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \
- __func__)
+#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, __func__)
-void compilerrt_abort_impl(const char *file, int line,
- const char *function) __attribute__((noreturn));
+NORETURN void compilerrt_abort_impl(const char *file, int line,
+ const char *function);
+
+#define COMPILE_TIME_ASSERT(expr) COMPILE_TIME_ASSERT1(expr, __COUNTER__)
+#define COMPILE_TIME_ASSERT1(expr, cnt) COMPILE_TIME_ASSERT2(expr, cnt)
+#define COMPILE_TIME_ASSERT2(expr, cnt) \
+ typedef char ct_assert_##cnt[(expr) ? 1 : -1] UNUSED
#endif /* INT_UTIL_H */