Sent to freebsd-hackers (2011-07-05) --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -1,12 +1,23 @@ # $FreeBSD$ +.if !defined(OPSYS) +OPSYS!= uname -s +.endif + # # Warning flags for compiling the kernel and components of the kernel: # +.if ${OPSYS} == "FreeBSD" +# FreeBSD extension, not available in upstream GCC +format_extensions= -fformat-extensions +no_align_long_strings= -mno-align-long-strings +.endif + 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_extensions} \ -Wmissing-include-dirs -fdiagnostics-show-option + # # The following flags are next up for working on: # -Wextra @@ -32,7 +43,7 @@ # .if ${MACHINE_CPUARCH} == "i386" .if ${CC:T:Mclang} != "clang" -CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse +CFLAGS+= ${no_align_long_strings} -mpreferred-stack-boundary=2 -mno-sse .else CFLAGS+= -mno-aes -mno-avx .endif