File: pre-5.1-static_assert.patch

package info (click to toggle)
ddcci-driver-linux 0.4.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 336 kB
  • sloc: ansic: 1,790; makefile: 123; sh: 3
file content (19 lines) | stat: -rw-r--r-- 688 bytes parent folder | download
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);