]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftest: af_unix: Support compilers without flex-array-member-not-at-end support
authorGuenter Roeck <linux@roeck-us.net>
Fri, 5 Dec 2025 17:10:00 +0000 (09:10 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 10 Dec 2025 09:08:51 +0000 (01:08 -0800)
Fix:

gcc: error: unrecognized command-line option ‘-Wflex-array-member-not-at-end’

by making the compiler option dependent on its support.

Fixes: 1838731f1072c ("selftest: af_unix: Add -Wall and -Wflex-array-member-not-at-end to CFLAGS.")
Cc: Kuniyuki Iwashima <kuniyu@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Link: https://patch.msgid.link/20251205171010.515236-7-linux@roeck-us.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/af_unix/Makefile

index 3cd677b720728af7b6e349ce27f8fedfac369722..4c0375e28bbeebcb9c02de760adccc369d57b8bd 100644 (file)
@@ -1,4 +1,9 @@
-CFLAGS += $(KHDR_INCLUDES) -Wall -Wflex-array-member-not-at-end
+top_srcdir := ../../../../..
+include $(top_srcdir)/scripts/Makefile.compiler
+
+cc-option = $(call __cc-option, $(CC),,$(1),$(2))
+
+CFLAGS += $(KHDR_INCLUDES) -Wall $(call cc-option,-Wflex-array-member-not-at-end)
 
 TEST_GEN_PROGS := \
        diag_uid \