Skip to content

Commit c905ecf

Browse files
committed
tools headers: Syncronize linux/build_bug.h with the kernel sources
To pick up the changes in: 07a368b ("bug: introduce ASSERT_STRUCT_OFFSET") This cset only introduces a build time assert macro, that may be useful at some point for tooling, for now it silences this perf build warning: Warning: Kernel ABI header at 'tools/include/linux/build_bug.h' differs from latest version at 'include/linux/build_bug.h' diff -u tools/include/linux/build_bug.h include/linux/build_bug.h Cc: Adrian Hunter <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Maxim Levitsky <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paolo Bonzini <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent d352588 commit c905ecf

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/include/linux/build_bug.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,13 @@
7979
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
8080
#endif // static_assert
8181

82+
83+
/*
84+
* Compile time check that field has an expected offset
85+
*/
86+
#define ASSERT_STRUCT_OFFSET(type, field, expected_offset) \
87+
BUILD_BUG_ON_MSG(offsetof(type, field) != (expected_offset), \
88+
"Offset of " #field " in " #type " has changed.")
89+
90+
8291
#endif /* _LINUX_BUILD_BUG_H */

0 commit comments

Comments
 (0)