1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Description: Add static_assert if necessary
Author: Stephen Kitt <skitt@debian.org>
static_assert was added in 5.1, define it if necessary so that the
module will build on older kernels.
--- a/ddcci/ddcci.c
+++ b/ddcci/ddcci.c
@@ -48,6 +48,10 @@
#ifndef sizeof_field
# define sizeof_field(t,m) FIELD_SIZEOF(t,m)
#endif
+#ifndef static_assert
+# define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
+# define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
+#endif
static_assert(sizeof_field(struct ddcci_device, prot) > 8);
static_assert(sizeof_field(struct ddcci_device, type) > 8);
static_assert(sizeof_field(struct ddcci_device, model) > 8);
|