Index: head/share/mk/bsd.sys.mk =================================================================== --- head/share/mk/bsd.sys.mk (revision 169960) +++ head/share/mk/bsd.sys.mk (revision 169961) @@ -1,79 +1,81 @@ # $FreeBSD$ # # This file contains common settings used for building FreeBSD # sources. # Enable various levels of compiler warning checks. These may be # overridden (e.g. if using a non-gcc compiler) by defining NO_WARNS. # for GCC: http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html#IDX143 # Universally disable -Werror until src/ is in better shape for GCC 4.2 NO_WERROR= .if !defined(NO_WARNS) && ${CC} != "icc" . if defined(CSTD) . if ${CSTD} == "k&r" CFLAGS += -traditional . elif ${CSTD} == "c89" || ${CSTD} == "c90" CFLAGS += -std=iso9899:1990 . elif ${CSTD} == "c94" || ${CSTD} == "c95" CFLAGS += -std=iso9899:199409 . elif ${CSTD} == "c99" CFLAGS += -std=iso9899:1999 . else CFLAGS += -std=${CSTD} . endif # -pedantic is problematic because it also imposes namespace restrictions #CFLAGS += -pedantic . endif . if defined(WARNS) . if ${WARNS} >= 1 CWARNFLAGS += -Wsystem-headers . if !defined(NO_WERROR) CWARNFLAGS += -Werror . endif . endif . if ${WARNS} >= 2 CWARNFLAGS += -Wall -Wno-format-y2k . endif . if ${WARNS} >= 3 CWARNFLAGS += -W -Wno-unused-parameter -Wstrict-prototypes\ -Wmissing-prototypes -Wpointer-arith . endif . if ${WARNS} >= 4 CWARNFLAGS += -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch\ -Wshadow -Wcast-align -Wunused-parameter . endif # BDECFLAGS . if ${WARNS} >= 6 CWARNFLAGS += -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls . endif . if ${WARNS} >= 2 && ${WARNS} <= 4 # XXX Delete -Wuninitialized by default for now -- the compiler doesn't # XXX always get it right. CWARNFLAGS += -Wno-uninitialized . endif +. if !defined(WITH_GCC3) CWARNFLAGS += -Wno-pointer-sign +. endif . endif . if defined(FORMAT_AUDIT) WFORMAT = 1 . endif . if defined(WFORMAT) . if ${WFORMAT} > 0 #CWARNFLAGS += -Wformat-nonliteral -Wformat-security -Wno-format-extra-args CWARNFLAGS += -Wformat=2 -Wno-format-extra-args . if !defined(NO_WERROR) CWARNFLAGS += -Werror . endif . endif . endif .endif .if defined(IGNORE_PRAGMA) CWARNFLAGS += -Wno-unknown-pragmas .endif # Allow user-specified additional warning flags CFLAGS += ${CWARNFLAGS} Index: head/sys/conf/kern.mk =================================================================== --- head/sys/conf/kern.mk (revision 169960) +++ head/sys/conf/kern.mk (revision 169961) @@ -1,96 +1,99 @@ # $FreeBSD$ # # Warning flags for compiling the kernel and components of the kernel. # # Note that the newly added -Wcast-qual is responsible for generating # most of the remaining warnings. Warnings introduced with -Wall will # also pop up, but are easier to fix. .if ${CC} == "icc" #CWARNFLAGS= -w2 # use this if you are terribly bored CWARNFLAGS= .else 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} -fformat-extensions +.if !defined(WITH_GCC3) +_Wno_pointer_sign=-Wno-pointer-sign +.endif .if !defined(NO_UNDEF) _wundef= -Wundef .endif .endif # # The following flags are next up for working on: # -W # # On the i386, do not align the stack to 16-byte boundaries. Otherwise GCC # 2.95 adds code to the entry and exit point of every function to align the # stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack # per function call. While the 16-byte alignment may benefit micro benchmarks, # it is probably an overall loss as it makes the code bigger (less efficient # use of code cache tag lines) and uses more stack (less efficient use of data # cache tag lines). Explicitly prohibit the use of SSE and other SIMD # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # .if ${MACHINE_ARCH} == "i386" && ${CC} != "icc" CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 \ -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 INLINE_LIMIT?= 8000 .endif .if ${MACHINE_ARCH} == "arm" INLINE_LIMIT?= 8000 .endif # # For IA-64, we use r13 for the kernel globals pointer and we only use # a very small subset of float registers for integer divides. # .if ${MACHINE_ARCH} == "ia64" CFLAGS+= -ffixed-r13 -mfixed-range=f32-f127 -fpic #-mno-sdata INLINE_LIMIT?= 15000 .endif # # For sparc64 we want medlow code model, and we tell gcc to use floating # point emulation. This avoids using floating point registers for integer # operations which it has a tendency to do. # .if ${MACHINE_ARCH} == "sparc64" CFLAGS+= -mcmodel=medany -msoft-float INLINE_LIMIT?= 15000 .endif # # For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # .if ${MACHINE_ARCH} == "amd64" CFLAGS+= -mcmodel=kernel -mno-red-zone \ -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow \ -msoft-float -fno-asynchronous-unwind-tables INLINE_LIMIT?= 8000 .endif # # For PowerPC we tell gcc to use floating point emulation. This avoids using # floating point registers for integer operations which it has a tendency to do. # .if ${MACHINE_ARCH} == "powerpc" CFLAGS+= -msoft-float INLINE_LIMIT?= 15000 .endif # # GCC 3.0 and above like to do certain optimizations based on the # assumption that the program is linked against libc. Stop this. # .if ${CC} == "icc" CFLAGS+= -nolib_inline .else CFLAGS+= -ffreestanding .endif .if ${CC} == "icc" CFLAGS+= -restrict .endif