[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240528202833.GB2680415@thelio-3990X>
Date: Tue, 28 May 2024 13:28:33 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: John Hubbard <jhubbard@...dia.com>
Cc: Shuah Khan <shuah@...nel.org>,
Beau Belgrave <beaub@...ux.microsoft.com>,
Steven Rostedt <rostedt@...dmis.org>,
Mark Brown <broonie@...nel.org>,
Naresh Kamboju <naresh.kamboju@...aro.org>,
sunliming <sunliming@...inos.cn>,
Masami Hiramatsu <mhiramat@...nel.org>,
Valentin Obst <kernel@...entinobst.de>,
linux-kselftest@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>, llvm@...ts.linux.dev
Subject: Re: [PATCH v2] selftests/user_events: silence a clang warning:
address of packed member
Hi John,
On Mon, May 27, 2024 at 02:47:04PM -0700, John Hubbard wrote:
> When building with clang, via:
>
> make LLVM=1 -C tools/testing/selftest
>
> ...clang warns about "taking address of packed member 'write_index' ".
> This is not particularly helpful, because the test code really wants to
> write to exactly this location, and if it ends up being unaligned, then
> the test won't work (and may segfault, depending on the CPU type).
>
> If that ever comes up, it will be obvious and can be fixed. But all it's
> doing now is prevent a clean clang build, so disable the warning.
>
> Signed-off-by: John Hubbard <jhubbard@...dia.com>
> ---
>
> Changes since the first version:
>
> 1) Rebased onto Linux 6.10-rc1
>
>
> thanks,
> John Hubbard
>
>
> tools/testing/selftests/user_events/Makefile | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/testing/selftests/user_events/Makefile b/tools/testing/selftests/user_events/Makefile
> index 10fcd0066203..617e94344711 100644
> --- a/tools/testing/selftests/user_events/Makefile
> +++ b/tools/testing/selftests/user_events/Makefile
> @@ -1,5 +1,10 @@
> # SPDX-License-Identifier: GPL-2.0
> CFLAGS += -Wl,-no-as-needed -Wall $(KHDR_INCLUDES)
> +
> +ifneq ($(LLVM),)
Perhaps it would be better if this were
ifeq ($(CC),clang)
as that would catch both CC=clang and LLVM=1 users? I haven't tested
this though.
Additionally, I think it would be good to mention that
-Wno-address-of-packed-member is GCC's default, whereas Clang enables
-Waddress-of-packed-member by default.
> + CFLAGS += -Wno-address-of-packed-member
> +endif
> +
> LDLIBS += -lrt -lpthread -lm
>
> TEST_GEN_PROGS = ftrace_test dyn_test perf_test abi_test
>
> base-commit: 2bfcfd584ff5ccc8bb7acde19b42570414bf880b
> --
> 2.45.1
>
>
Powered by blists - more mailing lists