summaryrefslogtreecommitdiff
path: root/tools/include/linux/build_bug.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2023-01-23 09:56:00 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-01-23 09:56:00 -0300
commit91f67b9a6472a243e2c0630f637ddff0af08038e (patch)
tree2ba948b5b9a9c13b3494efb3a4006c15db1cbb37 /tools/include/linux/build_bug.h
parent5670ebf54bd26482f57a094c53bdc562c106e0a9 (diff)
parent2475bf0250dee99b477e0c56d7dc9d7ac3f04117 (diff)
Merge remote-tracking branch 'torvalds/master' into perf/core
To pick fixes that went via perf/urgent. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/include/linux/build_bug.h')
-rw-r--r--tools/include/linux/build_bug.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/include/linux/build_bug.h b/tools/include/linux/build_bug.h
index cc7070c7439b..b4898ff085de 100644
--- a/tools/include/linux/build_bug.h
+++ b/tools/include/linux/build_bug.h
@@ -79,4 +79,13 @@
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
#endif // static_assert
+
+/*
+ * Compile time check that field has an expected offset
+ */
+#define ASSERT_STRUCT_OFFSET(type, field, expected_offset) \
+ BUILD_BUG_ON_MSG(offsetof(type, field) != (expected_offset), \
+ "Offset of " #field " in " #type " has changed.")
+
+
#endif /* _LINUX_BUILD_BUG_H */