diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 796d169..eec7408 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -36,7 +36,7 @@ CWARNFLAGS += -Werror CWARNFLAGS += -Wall -Wno-format-y2k . endif . if ${WARNS} >= 3 -CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\ +CWARNFLAGS += -Wextra -Wno-unused-parameter -Wstrict-prototypes\ -Wmissing-prototypes -Wpointer-arith . endif . if ${WARNS} >= 4 diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index a0a595f..91560e0 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -3,10 +3,9 @@ # # Warning flags for compiling the kernel and components of the kernel: # -CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ - -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ - -Wundef -Wno-pointer-sign -fformat-extensions \ - -Wmissing-include-dirs -fdiagnostics-show-option +CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes\ + -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual\ + -Wundef -Wno-pointer-sign -Wmissing-include-dirs # # The following flags are next up for working on: # -Wextra @@ -83,7 +82,7 @@ CFLAGS+= -mno-sse .else CFLAGS+= -mno-aes -mno-avx .endif -CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float \ +CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float\ -fno-asynchronous-unwind-tables INLINE_LIMIT?= 8000 .endif @@ -120,11 +119,19 @@ INLINE_LIMIT?= 8000 CFLAGS+= -ffreestanding # +# Enable FreeBSD kernel-specific printf format specifiers. Also instruct gcc to +# enable some diagnostics, which make it easier to pinpoint tinderbox failures. +# Clang already has these diagnostics enabled by default. +# +CFLAGS+= -fformat-extensions -fdiagnostics-show-option + +# # GCC SSP support # .if ${MK_SSP} != "no" && ${MACHINE_CPUARCH} != "ia64" && \ ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" -CFLAGS+= -fstack-protector +SSP_CFLAGS?= -fstack-protector +CFLAGS+= ${SSP_CFLAGS} .endif # diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index e9aa6e2..6800d30 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -30,7 +30,11 @@ CTFFLAGS+= -g _MINUS_O= -O2 .endif .if ${MACHINE_CPUARCH} == "amd64" -COPTFLAGS?=-O2 -frename-registers -pipe +.if ${CC:T:Mclang} != "clang" +COPTFLAGS?= -O2 -frename-registers -pipe +.else +COPTFLAGS?= -O2 -pipe +.endif .else COPTFLAGS?=${_MINUS_O} -pipe .endif