summaryrefslogtreecommitdiff
path: root/kerncompat.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-10-04 22:14:12 +0200
committerDavid Sterba <dsterba@suse.com>2016-10-05 12:39:01 +0200
commitc8d9f05cec0421a0eb3476a664da7d5a0767284d (patch)
tree2f5b5d2dd3484da4c1b145cdf07703b230abb6cf /kerncompat.h
parenteae42a1fe4f1d7a2236b9cdb9c957bf1b1cc175c (diff)
btrfs-progs: kerncompat: add build-time assertion support
Macro to verify compile-time conditions, like sie of structures or types. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'kerncompat.h')
-rw-r--r--kerncompat.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/kerncompat.h b/kerncompat.h
index 0cd85dc6..ea04ef3a 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -68,6 +68,10 @@
#define ULONG_MAX (~0UL)
#endif
+#define __token_glue(a,b,c) ___token_glue(a,b,c)
+#define ___token_glue(a,b,c) a ## b ## c
+#define BUILD_ASSERT(x) extern int __token_glue(compile_time_assert_,__LINE__,__COUNTER__)[1-2*!(x)] __attribute__((unused))
+
#ifndef BTRFS_DISABLE_BACKTRACE
#define MAX_BACKTRACE 16
static inline void print_trace(void)