Define `static_assert()` when not defined by kernel
[lttng-modules.git] / include / wrapper / compiler.h
index 40a472d6d4ba6ae0bce647ee74de88ff479b5c3a..ade06fe702de4e4133868fb7ece4509b4c0369de 100644 (file)
 
 #define __LTTNG_COMPOUND_LITERAL(type, ...)    (type[]) { __VA_ARGS__ }
 
+/*
+ * The static_assert macro was defined by the kernel in v5.1.
+ * If the macro is not defined, we define it.
+ * (kernel source: include/linux/build_bug.h)
+ */
+#ifndef static_assert
+
+# define static_assert(expr, ...)  __static_assert(expr, ##__VA_ARGS__, #expr)
+# define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
+
+#endif
+
 #endif /* _LTTNG_WRAPPER_COMPILER_H */
This page took 0.023621 seconds and 4 git commands to generate.