Message ID | 20200219045423.54190-5-natechancellor@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Silence some instances of -Wtautological-compare and enable globally | expand |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index aae17d9522e5..c7350aa6e853 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1031,7 +1031,7 @@ static int __init dynamic_debug_init(void) int n = 0, entries = 0, modct = 0; int verbose_bytes = 0; - if (__start___verbose == __stop___verbose) { + if (COMPARE_SECTIONS(__start___verbose, ==, __stop___verbose)) { pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n"); return 1; }
Clang warns: ../lib/dynamic_debug.c:1016:24: warning: array comparison always evaluates to false [-Wtautological-compare] if (__start___verbose == __stop___verbose) { ^ 1 warning generated. These are not true arrays, they are linker defined symbols, which are just addresses so there is not a real issue here. Use the COMPARE_SECTIONS macro to silence this warning by casting the linker defined symbols to unsigned long, which keeps the logic the same. Link: https://github.com/ClangBuiltLinux/linux/issues/765 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> --- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)