[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YuGUdHVhfwjobDJP@dev-arch.thelio-3990X>
Date: Wed, 27 Jul 2022 12:39:32 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Petr Mladek <pmladek@...e.com>
Cc: Justin Stitt <justinstitt@...gle.com>, ndesaulniers@...gle.com,
andriy.shevchenko@...ux.intel.com, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, rostedt@...dmis.org,
senozhatsky@...omium.org, trix@...hat.com
Subject: Re: [PATCH v4] lib/test_printf.c: fix clang -Wformat warnings
Hi Petr,
On Tue, Jul 19, 2022 at 02:17:47PM +0200, Petr Mladek wrote:
> On Mon 2022-07-18 16:06:26, Justin Stitt wrote:
> > see warnings:
> > | lib/test_printf.c:157:52: error: format specifies type 'unsigned char'
> > | but the argument has type 'int' [-Werror,-Wformat]
> > test("0|1|1|128|255",
> > | "%hhu|%hhu|%hhu|%hhu|%hhu", 0, 1, 257, 128, -1);
> > -
> > | lib/test_printf.c:158:55: error: format specifies type 'char' but the
> > | argument has type 'int' [-Werror,-Wformat] test("0|1|1|-128|-1",
> > | "%hhd|%hhd|%hhd|%hhd|%hhd", 0, 1, 257, 128, -1);
> > -
> > | lib/test_printf.c:159:41: error: format specifies type 'unsigned
> > short'
> > | but the argument has type 'int' [-Werror,-Wformat]
> > | test("2015122420151225", "%ho%ho%#ho", 1037, 5282, -11627);
> >
> > There's an ongoing movement to eventually enable the -Wformat flag for
> > clang. Previous patches have targeted incorrect usage of
> > format specifiers. In this case, however, the "incorrect" format
> > specifiers are intrinsically part of the test cases. Hence, fixing them
> > would be misaligned with their intended purpose. My proposed fix is to
> > simply disable the warnings so that one day a clean build of the kernel
> > with clang (and -Wformat enabled) would be possible. It would also keep
> > us in the green for alot of the CI bots.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/378
> > Suggested-by: Nathan Chancellor <nathan@...nel.org>
> > Suggested-by: Nick Desaulniers <ndesaulniers@...gle.com>
> > Signed-off-by: Justin Stitt <justinstitt@...gle.com>
>
> Looks good to me:
>
> Reviewed-by: Petr Mladek <pmladek@...e.com>
Would you be able to take this for 5.20 or should we ask Andrew to pick
it up? It seems you two seem to split applying patches to this file and
we are trying to get -Wformat enabled for clang in 5.20.
Cheers,
Nathan
Powered by blists - more mailing lists