[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tyndur-devel] [PATCH 01/11] kernel2: BUILD_BUG_ON()
+ kernel2: BUILD_BUG_ON()-Makro für statische Zusicherungen
Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
src/kernel2/include/kernel.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/kernel2/include/kernel.h b/src/kernel2/include/kernel.h
index 7fa8209..cd60247 100644
--- a/src/kernel2/include/kernel.h
+++ b/src/kernel2/include/kernel.h
@@ -42,6 +42,11 @@ extern uint64_t timer_ticks;
__attribute__((noreturn)) void panic(char* message, ...);
+#define GLUE(x,y) x ## y
+#define BUILD_ASSERT(cnt) GLUE(__cdi_build_assert, cnt)
+#define BUILD_BUG_ON(x) \
+ struct BUILD_ASSERT(__COUNTER__) { int assertion[(x) ? -1 : 1]; };
+
#define BUG_ON(c) \
do { \
if (c) { \
--
2.1.4