Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

John Hubbard and committed by
Shuah Khan
a84a0c6a 256abd8e

+8
+8
tools/testing/selftests/lib.mk
··· 38 38 CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) 39 39 endif # CROSS_COMPILE 40 40 41 + # gcc defaults to silence (off) for the following warnings, but clang defaults 42 + # to the opposite. The warnings are not useful for the kernel itself, which is 43 + # why they have remained disabled in gcc for the main kernel build. And it is 44 + # only due to including kernel data structures in the selftests, that we get the 45 + # warnings from clang. Therefore, disable the warnings for clang builds. 46 + CFLAGS += -Wno-address-of-packed-member 47 + CFLAGS += -Wno-gnu-variable-sized-type-not-at-end 48 + 41 49 CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as 42 50 else 43 51 CC := $(CROSS_COMPILE)gcc