[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH v2 1/5] cdi/misc.h: Add CDI_BUILD_BUG_ON() macro



Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 include/cdi/misc.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/cdi/misc.h b/include/cdi/misc.h
index a9f60b9..07967ec 100644
--- a/include/cdi/misc.h
+++ b/include/cdi/misc.h
@@ -15,6 +15,12 @@
 
 #include <cdi.h>
 
+#define CDI_GLUE(x,y) x ## y
+#define CDI_BUILD_ASSERT(cnt) CDI_GLUE(__cdi_build_assert, cnt)
+#define CDI_BUILD_BUG_ON(x) \
+    struct CDI_BUILD_ASSERT(__COUNTER__) { int assertion[(x) ? -1 : 1];  };
+
+
 #ifdef __cplusplus
 extern "C" {
 #endif
-- 
1.7.7