public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Shuah Khan <skhan@linuxfoundation.org>, Shuah Khan <shuah@kernel.org>
Cc: Beau Belgrave <beaub@linux.microsoft.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mark Brown <broonie@kernel.org>,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Bill Wendling <morbo@google.com>,
	sunliming <sunliming@kylinos.cn>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Valentin Obst <kernel@valentinobst.de>,
	linux-kselftest@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	llvm@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>
Subject: Re: [PATCH 2/2] selftests/lib.mk: silence some clang warnings that gcc already ignores
Date: Thu, 30 May 2024 12:28:14 -0700	[thread overview]
Message-ID: <e0f3563b-5cd7-4f3c-ae7c-4478c25d527c@nvidia.com> (raw)
In-Reply-To: <88c64f5e-4586-4b38-b3c8-0c3af93a71ae@linuxfoundation.org>

On 5/30/24 7:25 AM, Shuah Khan wrote:
> On 5/28/24 20:08, John Hubbard wrote:
>> gcc defaults to silence (off) for the following warnings, but clang
>> defaults to the opposite. These warnings are not useful for kselftests,
>> so silence them for the clang builds as well:
> 
> Please you add more information on why they aren't useful
> for kselftests.

Ah OK. My wording is a little misleading. The warnings are not useful
for the *kernel*, as previous decided by the gcc settings when building
the kernel. And it is only only due to including kernel data structures
in the selftests, that we get the warnings on clang.

So it is not something unique to the selftests. There is nothing that
the selftests' code does that triggers these warnings, other than the
act of including the kernel's data structures.

I can post a v2 to update both the comment and the commit description.


thanks,
-- 
John Hubbard
NVIDIA

> 
>>
>>      -Wno-address-of-packed-member
>>      -Wno-gnu-variable-sized-type-not-at-end
>>
>> This eliminates warnings for the net/ and user_events/ kselftest
>> subsystems, in these files:
>>
>>      ./net/af_unix/scm_rights.c
>>      ./net/timestamping.c
>>      ./net/ipsec.c
>>      ./user_events/perf_test.c
>>
>> Cc: Nathan Chancellor <nathan@kernel.org>
>> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
>> ---
>>   tools/testing/selftests/lib.mk | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/tools/testing/selftests/lib.mk 
>> b/tools/testing/selftests/lib.mk
>> index 2902787b89b2..41e879f3f8a2 100644
>> --- a/tools/testing/selftests/lib.mk
>> +++ b/tools/testing/selftests/lib.mk
>> @@ -50,6 +50,12 @@ else
>>   CLANG_FLAGS     += --target=$(notdir $(CROSS_COMPILE:%-=%))
>>   endif # CROSS_COMPILE
>> +# gcc defaults to silence (off) for the following warnings, but clang 
>> defaults
>> +# to the opposite. These warnings are not useful for kselftests, so 
>> silence them
>> +# for the clang builds as well.
>> +CFLAGS += -Wno-address-of-packed-member
>> +CFLAGS += -Wno-gnu-variable-sized-type-not-at-end
>> +
>>   CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as
>>   else
>>   CC := $(CROSS_COMPILE)gcc
> 
> thanks,
> -- Shuah
> 



  reply	other threads:[~2024-05-30 19:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29  2:08 [PATCH 0/2] selftests/lib.mk: LLVM=1, CC=clang, and warnings John Hubbard
2024-05-29  2:08 ` [PATCH 1/2] selftests/lib.mk: handle both LLVM=1 and CC=clang builds John Hubbard
2024-05-30  5:04   ` Muhammad Usama Anjum
2024-05-29  2:08 ` [PATCH 2/2] selftests/lib.mk: silence some clang warnings that gcc already ignores John Hubbard
2024-05-30 14:25   ` Shuah Khan
2024-05-30 19:28     ` John Hubbard [this message]
2024-05-31 14:30       ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0f3563b-5cd7-4f3c-ae7c-4478c25d527c@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=beaub@linux.microsoft.com \
    --cc=broonie@kernel.org \
    --cc=justinstitt@google.com \
    --cc=kernel@valentinobst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mhiramat@kernel.org \
    --cc=morbo@google.com \
    --cc=naresh.kamboju@linaro.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=sunliming@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox