Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v2] selftests/user_events: silence a clang warning: address of packed member
@ 2024-05-27 21:47 John Hubbard
  2024-05-28 20:28 ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: John Hubbard @ 2024-05-27 21:47 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Beau Belgrave, Steven Rostedt, Mark Brown, Naresh Kamboju,
	sunliming, Masami Hiramatsu, Valentin Obst, linux-kselftest, LKML,
	llvm, John Hubbard

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@nvidia.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),)
+    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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-28 20:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 21:47 [PATCH v2] selftests/user_events: silence a clang warning: address of packed member John Hubbard
2024-05-28 20:28 ` Nathan Chancellor
2024-05-28 20:35   ` Nathan Chancellor
2024-05-28 20:54     ` John Hubbard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox