Re: [PATCH] sched/fair: Replace zero-length array with flexible-array member

From: Peter Zijlstra
Date: Thu Feb 13 2020 - 12:07:04 EST


On Thu, Feb 13, 2020 at 10:58:31AM -0600, Gustavo A. R. Silva wrote:
> > Hurmph, and where are all the other similar changes for kernel/sched/ ?
> > Because this really isn't the only such usage and I really don't see the
> > point in having a separate patch for every single one of them.
> >
>
> Yeah. I can do that. I'll send a patch for the whole kernel/sched.

Thanks!

> > Also; couldn't you've taught the compiler to also warn about [0] ?
> > There's really no other purpose to having a zero length array.
> >
>
> Yeah, this is something we'd like to see in the short future.
> Unfortunately, for now, the only way for the compiler to warn
> about zero-length arrays in through the use of "-pedantic".
> And we definitely don't want to follow this path.
>
> What we can do, in the meantime, is to add a test for it to
> checkpatch.

Oh, I means, warn if it isn't the last member of a struct. Not warn on
any use. Or we mean the same and I'm just confused.