[lkml]   [2018]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Question on FIELD_PREP() for static array
On Thu, 2018-10-11 at 15:24 +0100, John Garry wrote:
> > +#define BUILD_BUG_ON_RET_ZERO(cond) (sizeof(char[1 - 2*!!(cond)]) - 1)
> > +#define BUILD_BUG_ON_NOT_POW2_RET_ZERO(n) BUILD_BUG_ON_RET_ZERO(((n) & ((n) - 1)) != 0)

> Seems reasonable. However I did try this and was getting compiler
> warnings about VLA, from a non-constant being fed into
> BUILD_BUG_ON_RET_ZERO(), related to sizeof char[]:
> drivers/iio/adc/meson_saradc.c:375:2: warning: ISO C90 forbids variable
> length array [-Wvla]

Hmm, what's the code there?

I don't see why the compiler should think it's a variable length?

> Surely __NLA_ENSURE is getting a similar issue as it uses a similar
> principle, no? I see that this is in -next now, but could not this macro
> or derivatives being referenced.

Yeah, I have a patch now to reference it, but I don't see anything from
-Wvla with gcc 8.1?

and its parent.

Do you see -Wvla warnings there? Any idea how I could reproduce them?


 \ /
  Last update: 2018-10-11 17:25    [W:0.134 / U:14.640 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site