On Tue, Apr 29, 2025 at 04:41:03PM -0600, Uday Shankar wrote:
Compiler warnings can catch bugs at compile time; thus, heeding them is usually a good idea. Turn warnings into errors by default for the kublk build so that anyone making changes is forced to heed them. Compiler warnings can also sometimes produce annoying false positives, so provide a flag WERROR that the developer can use as follows to have the build and selftests run go through even if there are warnings:
make WERROR=0 TARGETS=ublk kselftest
I thought WERROR is 0 default, but actually the default value is 1.
Just tried gcc 14/15 and clang 18/20, looks everything works fine.
For kernel selftests, I guess the usual way is to do it explicitly by passing 'make -C tools/testing/selftests TARGETS=ublk'.
Even though the build fails for people who is running the test on purpose, or doling whole kernel selfests, they still can:
- report the failure
- skip ublk test by adding 'SKIP_TARGETS=ublk' to command line
Also this ways has been used by perf, lib/api, lib/subcmd and lib/sysmbol in linux kernel tools/, so I feel the change should be doable, but let Jens decide if it is fine to pass -Werror at default:
Reviewed-by: Ming Lei ming.lei@redhat.com
Otherwise, it still can be enabled conditionally with default off.
Thanks, Ming