selftests/net: suppress clang's "variable-sized type not at the end" warning
Subsystems (4)
PATCH v2 1/1 selftests/net: suppress clang's "variable-sized type not at the end" warning
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.
---
Changes since the first version:
1) Rebased onto Linux 6.10-rc1
thanks,
John Hubbard
tools/testing/selftests/net/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/net/Makefile +4 -0
@@ -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: 2bfcfd584ff5ccc8bb7acde19b42570414bf880b
Signature · 1 line
2.45.1
Hi John,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/9260539047
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/31d0136a686c
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=856310
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Quoted 35 lines · 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 <[email protected]>---
Changes since the first version:
1) Rebased onto Linux 6.10-rc1
thanks,
John Hubbardtools/testing/selftests/net/Makefile | 4 ++++ 1 file changed, 4 insertions(+)tools/testing/selftests/net/Makefile +0
-0
tools/testing/selftests/net/Makefile CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES) · line 10
Quoted 5 lines
tools/testing/selftests/net/Makefile +2
-0@@ -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
For what it's worth, the main kernel has -Wno-gnu because there is little point in warning about the use of GNU extensions when building with '-std=gnu...'. It may be worth doing this anywhere that uses a GNU standard in the selftests but I guess it depends on how noisy things are.
Quoted 11 lines
tools/testing/selftests/net/Makefile +2
-0+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.shbase-commit:
2bfcfd584ff5ccc8bb7acde19b42570414bf880bSignature · 1 line
2.45.1
Quoted 1 line · Nathan Chancellor
On Mon, May 27, 2024 at 02:36:41PM -0700, John Hubbard wrote:
...
Quoted 8 lines
Quoted 8 lines
tools/testing/selftests/net/Makefile +0
-0@@ -6,6 +6,10 @@ CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES) # Additional include paths needed by kselftest.h CFLAGS += -I../
Quoted 8 lines
tools/testing/selftests/net/Makefile CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES) · line 10
Quoted 2 lines
tools/testing/selftests/net/Makefile +2
-0+ifneq ($(LLVM),) + CFLAGS += -Wno-gnu-variable-sized-type-not-at-endFor what it's worth, the main kernel has -Wno-gnu because there is little point in warning about the use of GNU extensions when building with '-std=gnu...'. It may be worth doing this anywhere that uses a GNU standard in the selftests but I guess it depends on how noisy things are.
I think there might be one or two other cases like this that I haven't gotten around to, so yes you are right, this probably should be moved into lib.mk instead.
I'll do that in a v3.
Quoted 7 lines
Quoted 7 lines
tools/testing/selftests/net/Makefile +2
-0+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
Quoted 5 lines
Quoted 5 lines
base-commit:
2bfcfd584ff5ccc8bb7acde19b42570414bf880bSignature · 1 line
2.45.1
thanks,
Signature · 2 lines
John Hubbard NVIDIA