On Thu, Dec 04, 2025 at 09:40:54AM -0800, Jakub Kicinski wrote:
> On Thu, 4 Dec 2025 08:17:20 -0800 Guenter Roeck wrote:
> > -CFLAGS += $(KHDR_INCLUDES) -Wall -Wflex-array-member-not-at-end
> > +CFLAGS += $(KHDR_INCLUDES) -Wall $(call cc-option,-Wflex-array-member-not-at-end)
>
> Hm, the Claude code review we have hooked up to patchwork says:
>
> Is cc-option available in the selftest build environment? Looking at
> tools/testing/selftests/lib.mk (included at line 14), it doesn't include
> scripts/Makefile.compiler where cc-option is defined. When cc-option is
> undefined, $(call cc-option,...) expands to an empty string, which means
> the -Wflex-array-member-not-at-end flag won't be added even on compilers
> that support it.
>
> This defeats the purpose of commit 1838731f1072c which added the warning
> flag to catch flexible array issues.
>
> For comparison, tools/testing/selftests/nolibc/Makefile explicitly
> includes scripts/Makefile.compiler before using cc-option.
>
> Testing it:
>
> $ make -C tools/testing/selftests/ TARGETS=net/af_unix Q= V=1
> make: Entering directory '/home/kicinski/devel/linux/tools/testing/selftests'
> make[1]: Entering directory '/home/kicinski/devel/linux/tools/testing/selftests/net/af_unix'
> gcc -isystem /home/kicinski/devel/linux/usr/include -Wall -D_GNU_SOURCE= diag_uid.c -o /home/kicinski/devel/linux/tools/testing/selftests/net/af_unix/diag_uid
>
> looks like the flag just disappears. Even tho:
>
> gcc version 15.2.1
Oops :). I didn't expect that, sorry. Thanks for finding!
... and I guess it's time to set up AI in my environment.
Guenter