All of
 help / color / mirror / Atom feed
From: Nathan Chancellor <>
To: Ammar Faizi <>
Cc: Greg Kroah-Hartman <>,
	"Rafael J. Wysocki" <>,
	Linux Kernel Mailing List <>,
	Nick Desaulniers <>,
	Tom Rix <>,
	LLVM Mailing List <>
Subject: Re: [PATCH v1] driver core: Silence 'unused-but-set variable' warning
Date: Fri, 23 Dec 2022 10:31:08 -0700	[thread overview]
Message-ID: <Y6Xl3M7Tx+c2SCa9@dev-arch.thelio-3990X> (raw)
In-Reply-To: <>

On Fri, Dec 23, 2022 at 10:31:57PM +0700, Ammar Faizi wrote:
> On 12/23/22 10:02 PM, Greg Kroah-Hartman wrote:
> > Ick, no, that's horrid and is NOT ok for kernel code, sorry.
> > 
> > Please fix the compiler, this is not a "fix" in any sense of the word
> > and is not going to work at all for kernel code.

It is possible that the compiler should not emit
-Wunused-but-set-variable when the variable is assigned the return
value of a function marked with __attribute__((warn_unused_result)) but
neither compiler does that today, you'll see the exact same warning from
GCC 12.2.0:

  drivers/base/module.c: In function ‘module_add_driver’:
  drivers/base/module.c:36:13: error: variable ‘no_warn’ set but not used [-Werror=unused-but-set-variable]
     36 |         int no_warn;
        |             ^~~~~~~
  cc1: all warnings being treated as errors

This has come up before too:

> Agree.
> Sorry for the noise. It turned out I messed up my clang compiler flags.
> I forgot to do a "git reset --hard" before recompiling.
> This has nothing todo with the upstream kernel.

This warning is in W=1, which are warnings that we want to turn on at
some point but the current instances need to be fixed first, so I would
say this is still relevant to the upstream kernel.


      reply	other threads:[~2022-12-23 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 14:51 [PATCH v1] driver core: Silence 'unused-but-set variable' warning Ammar Faizi
2022-12-23 15:02 ` Greg Kroah-Hartman
2022-12-23 15:31   ` Ammar Faizi
2022-12-23 17:31     ` Nathan Chancellor [this message]

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:

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

  git send-email \
    --in-reply-to=Y6Xl3M7Tx+c2SCa9@dev-arch.thelio-3990X \ \ \ \ \ \ \ \ \

* 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.