Thread (24 messages) 24 messages, 3 authors, 2025-12-04

Re: [PATCH 06/13] selftest: af_unix: Support compilers without flex-array-member-not-at-end support

From: Jakub Kicinski <kuba@kernel.org>
Date: 2025-12-04 17:40:55
Also in: bpf, linux-kselftest, lkml

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 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help