diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 1ef2dd50a41..3565425086f 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -268,6 +268,7 @@ __DEFAULT_YES_OPTIONS = \ ED_CRYPTO \ EXAMPLES \ FLOPPY \ + FORMAT_EXTENSIONS \ FORTH \ FP_LIBC \ FREEBSD_UPDATE \ diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index e42b753e607..99211f0f4bf 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -5,7 +5,7 @@ # CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ - -Wundef -Wno-pointer-sign -fformat-extensions \ + -Wundef -Wno-pointer-sign ${FORMAT_EXTENTIONS} \ -Wmissing-include-dirs -fdiagnostics-show-option \ ${CWARNEXTRA} # @@ -29,7 +29,15 @@ NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \ - -Wno-error-parentheses-equality + -Wno-error-parentheses-equality ${NO_WFORMAT} +.endif + +# External compilers may not support our format extensions. Allow them +# to be disabled. WARNING: format checking is disabled in this case. +.if ${MK_FORMAT_EXTENSIONS} == "no" +NO_WFORMAT= -Wno-format +.else +FORMAT_EXTENTIONS= -fformat-extensions .endif # diff --git a/tools/build/options/WITHOUT_FORMAT_EXTENSIONS b/tools/build/options/WITHOUT_FORMAT_EXTENSIONS new file mode 100644 index 00000000000..7ae02e1bf86 --- /dev/null +++ b/tools/build/options/WITHOUT_FORMAT_EXTENSIONS @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to not enable +.Fl fformat-extensions +when compiling the kernel. +Also disables all format checking.