linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Garry <john.garry@huawei.com>, Joe Perches <joe@perches.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	jakub.kicinski@netronome.com, yamada.masahiro@socionext.com,
	Arnd Bergmann <arnd@arndb.de>,
	viro@zeniv.linux.org.uk,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: linux-wireless@vger.kernel.org, nbd@nbd.name
Subject: Re: Question on FIELD_PREP() for static array
Date: Thu, 11 Oct 2018 21:13:10 +0200	[thread overview]
Message-ID: <1539285190.4027.5.camel@sipsolutions.net> (raw)
In-Reply-To: <ec680438-babe-4ee7-988b-c2466a11e789@huawei.com>

On Thu, 2018-10-11 at 18:26 +0100, John Garry wrote:
> > > Yeah, I have a patch now to reference it, but I don't see anything from
> > > -Wvla with gcc 8.1?
> > 
> > I'm using a 7.3.1-based toolchain
> > 
> > > 
> > > See
> > > https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git/commit/?id=3d7af878357acd9e37fc156928106f1a969c8942
> > > 
> > > and its parent.
> > > 
> > > Do you see -Wvla warnings there? Any idea how I could reproduce them?
> > 
> > I'll try it, thanks
> 
> 3d7af878357acd9e37f builds ok. However I am using 20181010-next (I'm not 
> sure what yours is based on), and I just noticed that it includes this 
> new guy:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/Makefile?h=next-20181011&id=bc5701d8e27fd8beaf895176982fc6a97878f3b

Right, but I added -Wvla by adding subdir-ccflags-y to my Makefile for
this test, and I don't see the warning.

I tried with gcc 7.3.1 too now (Fedora 27) and it doesn't provoke the
warning, even if apply bc5701d8e27fd (manually). I did ensure with V=1
that it shows up on the compiler command line.

This is on x86-64, are you using something else?

Hmm.

However, I have another trick:

#define __NLA_ENSURE(condition) (0 * sizeof(struct { unsigned int x:1 - 2*!(condition);}))

or, in this context,

#define BUILD_BUG_ON_RET_ZERO(cond) (0 * sizeof(struct { unsigned int x:1 - 2*!(condition);}))


What do you think?

johannes

  reply	other threads:[~2018-10-11 19:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c8594a75-964b-01b0-382e-88bcb5b462f2@huawei.com>
     [not found] ` <40fd3d963820bf96547fa9b5e8c171c6a339674e.camel@perches.com>
2018-10-10 18:13   ` Question on FIELD_PREP() for static array Johannes Berg
2018-10-11 14:24     ` John Garry
2018-10-11 15:23       ` Johannes Berg
2018-10-11 16:16         ` John Garry
2018-10-11 17:26           ` John Garry
2018-10-11 19:13             ` Johannes Berg [this message]
2018-10-11 19:22               ` Johannes Berg

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=1539285190.4027.5.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=akpm@linux-foundation.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=arnd@arndb.de \
    --cc=jakub.kicinski@netronome.com \
    --cc=joe@perches.com \
    --cc=john.garry@huawei.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yamada.masahiro@socionext.com \
    /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).