diff options
author | John Hubbard <jhubbard@nvidia.com> | 2024-05-31 11:37:51 -0700 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2024-07-11 11:23:53 -0600 |
commit | a84a0c6a6d40b73f01033249ebe45c9484558539 (patch) | |
tree | 3f7d1f5d094f89a8f470ad50c85d75560e7023e5 /tools | |
parent | 256abd8e550ce977b728be79a74e1729438b4948 (diff) |
selftests/lib.mk: silence some clang warnings that gcc already ignores
gcc defaults to silence (off) for the following warnings, but clang
defaults to the opposite. The warnings are not useful for the kernel
itself, which is why they have remained disabled in gcc for the main
kernel build. And it is only due to including kernel data structures in
the selftests, that we get the warnings from clang.
-Waddress-of-packed-member
-Wgnu-variable-sized-type-not-at-end
In other words, the warnings are not unique to the selftests: there is
nothing that the selftests' code does that triggers these warnings,
other than the act of including the kernel's data structures. Therefore,
silence them for the clang builds as well.
This eliminates warnings for the net/ and user_events/ kselftest
subsystems, in these files:
./net/af_unix/scm_rights.c
./net/timestamping.c
./net/ipsec.c
./user_events/perf_test.c
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Acked-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/lib.mk | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 429535816dbd..7b299ed5ff45 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -38,6 +38,14 @@ else CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # CROSS_COMPILE +# gcc defaults to silence (off) for the following warnings, but clang defaults +# to the opposite. The warnings are not useful for the kernel itself, which is +# why they have remained disabled in gcc for the main kernel build. And it is +# only due to including kernel data structures in the selftests, that we get the +# warnings from clang. Therefore, disable the warnings for clang builds. +CFLAGS += -Wno-address-of-packed-member +CFLAGS += -Wno-gnu-variable-sized-type-not-at-end + CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as else CC := $(CROSS_COMPILE)gcc |