aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/linux/device.py
diff options
context:
space:
mode:
authorVegard Nossum <[email protected]>2020-04-06 20:09:37 -0700
committerLinus Torvalds <[email protected]>2020-04-07 10:43:42 -0700
commitaf9c5d2e3b355854ff0e4acfbfbfadcd5198a349 (patch)
tree0773e3ed616da23129f891c4ecdcf7a4bc684a19 /scripts/gdb/linux/device.py
parent889b3c1245de48ed0cacf7aebb25c489d3e4a3e9 (diff)
compiler.h: fix error in BUILD_BUG_ON() reporting
compiletime_assert() uses __LINE__ to create a unique function name. This means that if you have more than one BUILD_BUG_ON() in the same source line (which can happen if they appear e.g. in a macro), then the error message from the compiler might output the wrong condition. For this source file: #include <linux/build_bug.h> #define macro() \ BUILD_BUG_ON(1); \ BUILD_BUG_ON(0); void foo() { macro(); } gcc would output: ./include/linux/compiler.h:350:38: error: call to `__compiletime_assert_9' declared with attribute error: BUILD_BUG_ON failed: 0 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) However, it was not the BUILD_BUG_ON(0) that failed, so it should say 1 instead of 0. With this patch, we use __COUNTER__ instead of __LINE__, so each BUILD_BUG_ON() gets a different function name and the correct condition is printed: ./include/linux/compiler.h:350:38: error: call to `__compiletime_assert_0' declared with attribute error: BUILD_BUG_ON failed: 1 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) Signed-off-by: Vegard Nossum <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Reviewed-by: Masahiro Yamada <[email protected]> Reviewed-by: Daniel Santos <[email protected]> Cc: Rasmus Villemoes <[email protected]> Cc: Ian Abbott <[email protected]> Cc: Joe Perches <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/device.py')
0 files changed, 0 insertions, 0 deletions