linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH] waitqueue: fix clang -Wuninitialized warnings
Date: Tue, 9 Jul 2019 21:27:17 +0200	[thread overview]
Message-ID: <CAK8P3a041S8KFTz4ZjmByDUTM9pDxsWi=hGPeamkFfn4B1dcxQ@mail.gmail.com> (raw)
In-Reply-To: <20190703175845.GA68011@archlinux-epyc>

On Wed, Jul 3, 2019 at 7:58 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
> On Wed, Jul 03, 2019 at 10:10:55AM +0200, Arnd Bergmann wrote:
> > When CONFIG_LOCKDEP is set, every use of DECLARE_WAIT_QUEUE_HEAD_ONSTACK()
> > produces an annoying warning from clang, which is particularly annoying
> > for allmodconfig builds:
> >
> > fs/namei.c:1646:34: error: variable 'wq' is uninitialized when used within its own initialization [-Werror,-Wuninitialized]
> >         DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
> >                                         ^~
> > include/linux/wait.h:74:63: note: expanded from macro 'DECLARE_WAIT_QUEUE_HEAD_ONSTACK'
> >         struct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name)
> >                                ~~~~                                  ^~~~
> > include/linux/wait.h:72:33: note: expanded from macro '__WAIT_QUEUE_HEAD_INIT_ONSTACK'
> >         ({ init_waitqueue_head(&name); name; })
> >                                        ^~~~
> >
> > After playing with it for a while, I have found a way to rephrase the
> > macro in a way that should work well with both gcc and clang and not
> > produce this warning. The open-coded __WAIT_QUEUE_HEAD_INIT_ONSTACK
> > is a little more verbose than the original version by Peter Zijlstra,
> > but avoids the gcc-ism that suppresses warnings when assigning a
> > variable to itself.
> >
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> Tested-by: Nathan Chancellor <natechancellor@gmail.com>

Who would be the right person to pick this patch up for mainline?

I guess it may have to wait until the end of the merge window now,
but I'd still like this to be part of 4.3 and possibly backported to
the stable kernels as we build those with clang as well.

       Arnd

  reply	other threads:[~2019-07-09 19:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03  8:10 [PATCH] waitqueue: fix clang -Wuninitialized warnings Arnd Bergmann
2019-07-03 17:58 ` Nathan Chancellor
2019-07-09 19:27   ` Arnd Bergmann [this message]
2019-07-12  7:28     ` Peter Zijlstra
2019-07-12  0:49 ` Andrew Morton
2019-07-12  7:45   ` Arnd Bergmann
2019-07-12  7:54     ` Nathan Chancellor
2019-07-12 14:50       ` Arnd Bergmann
2019-07-12 16:48     ` Nick Desaulniers

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='CAK8P3a041S8KFTz4ZjmByDUTM9pDxsWi=hGPeamkFfn4B1dcxQ@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=natechancellor@gmail.com \
    --cc=peterz@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).