* [PATCH v2] selftests/net: suppress clang's "variable-sized type not at the end" warning
@ 2024-05-27 21:36 John Hubbard
2024-05-28 20:39 ` Nathan Chancellor
0 siblings, 1 reply; 3+ messages in thread
From: John Hubbard @ 2024-05-27 21:36 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>
---
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(+)
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index bd01e4a0be2c..9a3b766c8781 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: 2bfcfd584ff5ccc8bb7acde19b42570414bf880b
--
2.45.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] selftests/net: suppress clang's "variable-sized type not at the end" warning
2024-05-27 21:36 [PATCH v2] selftests/net: suppress clang's "variable-sized type not at the end" warning John Hubbard
@ 2024-05-28 20:39 ` Nathan Chancellor
2024-05-28 20:56 ` John Hubbard
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2024-05-28 20:39 UTC (permalink / raw)
To: John Hubbard
Cc: Shuah Khan, 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
On Mon, May 27, 2024 at 02:36:41PM -0700, John Hubbard wrote:
> 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>
> ---
>
> 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(+)
>
> diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
> index bd01e4a0be2c..9a3b766c8781 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
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.
> +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
> --
> 2.45.1
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] selftests/net: suppress clang's "variable-sized type not at the end" warning
2024-05-28 20:39 ` Nathan Chancellor
@ 2024-05-28 20:56 ` John Hubbard
0 siblings, 0 replies; 3+ messages in thread
From: John Hubbard @ 2024-05-28 20:56 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Shuah Khan, 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
On 5/28/24 1:39 PM, Nathan Chancellor wrote:
> On Mon, May 27, 2024 at 02:36:41PM -0700, John Hubbard wrote:
...
>> diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
>> index bd01e4a0be2c..9a3b766c8781 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
>
> 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.
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.
>
>> +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
>> --
>> 2.45.1
>>
>>
thanks,
--
John Hubbard
NVIDIA
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-28 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 21:36 [PATCH v2] selftests/net: suppress clang's "variable-sized type not at the end" warning John Hubbard
2024-05-28 20:39 ` Nathan Chancellor
2024-05-28 20:56 ` John Hubbard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).