public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests/net: suppress clang's "variable-sized type not at the end" warning
@ 2024-05-05 22:26 John Hubbard
  2024-05-05 22:26 ` [PATCH 2/2] selftests/net: fix uninitialized variables John Hubbard
  0 siblings, 1 reply; 5+ messages in thread
From: John Hubbard @ 2024-05-05 22:26 UTC (permalink / raw)
  To: Shuah Khan
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Steffen Klassert, Herbert Xu, Andreas Färber,
	Manivannan Sadhasivam, Matthieu Baerts, Mat Martineau,
	Geliang Tang, Pravin B Shelar, Willem de Bruijn,
	Alexander Mikhalitsyn, zhujun2, Petr Machata, Ido Schimmel,
	Hangbin Liu, Nikolay Aleksandrov, Benjamin Poirier,
	Sebastian Andrzej Siewior, Dmitry Safonov, netdev,
	linux-arm-kernel, linux-actions, mptcp, dev, Valentin Obst,
	linux-kselftest, LKML, llvm, John Hubbard

When building with clang, via:

    make LLVM=1 -C tools/testing/selftest

...clang warns that "a variable sized type not at the end of a struct or
class is a GNU extension".

These cases are not easily changed, because they involve structs that
are part of the API. Fortunately, however, the tests seem to be doing
just fine (specifically, neither affected test runs any differently with
gcc vs. clang builds, on my test system) regardless of the warning. So,
all the warning is doing is preventing a clean build of selftests/net.

Fix this by suppressing this particular clang warning for the
selftests/net suite.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 tools/testing/selftests/net/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 7b6918d5f4af..956481174783 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -6,6 +6,10 @@ CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES)
 # Additional include paths needed by kselftest.h
 CFLAGS += -I../
 
+ifneq ($(LLVM),)
+    CFLAGS += -Wno-gnu-variable-sized-type-not-at-end
+endif
+
 TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh \
 	      rtnetlink.sh xfrm_policy.sh test_blackhole_dev.sh
 TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh ip_defrag.sh

base-commit: f462ae0edd3703edd6f22fe41d336369c38b884b
prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27
-- 
2.45.0


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

end of thread, other threads:[~2024-05-06 18:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-05 22:26 [PATCH 1/2] selftests/net: suppress clang's "variable-sized type not at the end" warning John Hubbard
2024-05-05 22:26 ` [PATCH 2/2] selftests/net: fix uninitialized variables John Hubbard
2024-05-06  7:49   ` Matthieu Baerts
2024-05-06 18:00   ` Willem de Bruijn
2024-05-06 18:50     ` John Hubbard

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