[PATCH v2 00/10] replace zero length arrays
Tyler Retzlaff
roretzla at linux.microsoft.com
Fri Nov 17 20:59:57 CET 2023
On Fri, Nov 17, 2023 at 08:18:23AM -0800, Stephen Hemminger wrote:
> On Fri, 17 Nov 2023 09:31:11 +0100
> Morten Brørup <mb at smartsharesystems.com> wrote:
>
> > Series-acked-by: Morten Brørup <mb at smartsharesystems.com>
> >
> > Suggest checkpatches to disallow this, if it doesn't already.
>
> Unfortunately, matching this with awk is too hard. Coccinelle can do it
> but don't want to introduce dependency on that.
>
> Maybe a compiler flag would be possible, but could not find one.
-pedantic will warn, but to use it without clobbering the build with
warnings we would probably need to qualify all use of non-standard
extensions with the __extension__ keyword.
```
struct foo {
int a;
int b;
char buffer[0];
};
```
zhora ~> gcc -Wall -pedantic oink.c
oink.c:7:14: warning: ISO C forbids zero-size array ‘buffer’ [-Wpedantic]
7 | char buffer[0];
More information about the dev
mailing list