Remove -fms-extensions throughout the tree

During a discussion about using -fms-extensions jhb pointed out that
we have them enabled in the kernel for gcc by default (even multiple
times in one part). I had missed all that and clang still failed on
my use case (needing another option).

The original cause for enabling them for our tree back then was that
we needed to support C11 anonymous struct/unions.
Our in-tree gcc 4.2.1, despite later patches, needed the
-fms-extensions to support these even though this was not the expected
use case for that option ( cc4a90c445 enabled it globally for the
kernel).
clang at that time (or at least when it became default for 10.0)
already was fine (with C11).

Any later gcc (4.6.0 onwards) did not need that option anymore, even
when compiled for -std=iso9899:1990 (which does not support anonymous
structs/unions) unless one would add -pedantic (see gcc git 4bdd0a60b27a).
This is also the reason why userland cddl sources now compile with the
option removed despite CSTD=c99.

The only driver which needed the option recently was ccp, but that was
fixed in 8d3f41dbcb by jhb.

So cleanup all uses cases of -fms-extensions for the moment as they are
no longer needed given all compilers currently supported seem to be
fine without them and gcc-4.2.1 was removed from the tree in stable/13
in 2020 (a9854bc381).

Reported by:	jhb (all this but possibly the world CDDL parts)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste (earlier), imp, jhb, glebius
Differential Revision: https://reviews.freebsd.org/D55072
This commit is contained in:
Bjoern A. Zeeb
2026-02-03 01:51:40 +00:00
parent 5923b363ca
commit 93d301d95a
8 changed files with 2 additions and 9 deletions
-1
View File
@@ -281,7 +281,6 @@ CFLAGS+= -DWANTS_MUTEX_OWNED
CFLAGS+= -I${SRCTOP}/lib/libpthread/thread
CFLAGS+= -I${SRCTOP}/lib/libpthread/sys
CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include
CFLAGS.gcc+= -fms-extensions
LIBADD= md pthread z spl icp nvpair avl umem
-1
View File
@@ -28,7 +28,6 @@ CSTD= c99
# Since there are many asserts in this program, it makes no sense to compile
# it without debugging.
CFLAGS+= -g -DDEBUG=1 -Wno-format -DZFS_DEBUG=1
CFLAGS.gcc+= -fms-extensions
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
-1
View File
@@ -24,7 +24,6 @@ CFLAGS+= \
LIBADD= nvpair umem zdb zfs_core zfs spl avl zutil zpool crypto pthread
CFLAGS.gcc+= -fms-extensions
# Since there are many asserts in this program, it makes no sense to compile
# it without debugging.
CFLAGS+= -g -DDEBUG=1 -DZFS_DEBUG=1
+1 -2
View File
@@ -78,10 +78,9 @@ CFLAGS= ${COPTFLAGS} ${DEBUG}
CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
CFLAGS_PARAM_INLINE_UNIT_GROWTH?=100
CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000
CFLAGS.gcc+= -fms-extensions -finline-limit=${INLINE_LIMIT}
CFLAGS.gcc+= -finline-limit=${INLINE_LIMIT}
CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH}
CFLAGS.gcc+= --param large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH}
CFLAGS.gcc+= -fms-extensions
.if defined(CFLAGS_ARCH_PARAMS)
CFLAGS.gcc+=${CFLAGS_ARCH_PARAMS}
.endif
-1
View File
@@ -139,7 +139,6 @@ CFLAGS+= -include ${.OBJDIR}/opt_global.h
CFLAGS+= -I. -I${SYSDIR} -I${SYSDIR}/contrib/ck/include
CFLAGS.gcc+= -finline-limit=${INLINE_LIMIT}
CFLAGS.gcc+= -fms-extensions
CFLAGS.gcc+= --param inline-unit-growth=100
CFLAGS.gcc+= --param large-function-growth=1000
-1
View File
@@ -17,7 +17,6 @@ CFLAGS+= -I${SYSDIR}/ofed/include/uapi
CFLAGS+= ${LINUXKPI_INCLUDES}
CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM
CFLAGS+= -DINET6 -DINET
CFLAGS+= -fms-extensions
CFLAGS+=-DICL_KERNEL_PROXY
-1
View File
@@ -17,7 +17,6 @@
${SRCTOP}/sys/dev/pms/freebsd/driver/common
CFLAGS+=-fno-builtin
CFLAGS+=-fms-extensions
CFLAGS+=-Wredundant-decls
CFLAGS+=-Wunused-variable
+1 -1
View File
@@ -2,7 +2,7 @@
files "dpaa/files.dpaa"
makeoptions DPAA_COMPILE_CMD="${LINUXKPI_C} ${DPAAWARNFLAGS} \
-Wno-cast-qual -Wno-unused-function -Wno-init-self -fms-extensions \
-Wno-cast-qual -Wno-unused-function -Wno-init-self \
-include $S/contrib/ncsw/build/dflags.h \
-Wno-error=missing-prototypes \
-I$S/contrib/ncsw/build/ \