Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Oct 2011 18:28:54 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Robert Millan <rmh@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r226665 - head/sys/conf
Message-ID:  <20111026182854.GA73322@freebsd.org>
In-Reply-To: <201110231627.p9NGR47P046269@svn.freebsd.org>
References:  <201110231627.p9NGR47P046269@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun Oct 23 11, Robert Millan wrote:
> Author: rmh
> Date: Sun Oct 23 16:27:03 2011
> New Revision: 226665
> URL: http://svn.freebsd.org/changeset/base/226665
> 
> Log:
>   Conditionalize a pair of FreeBSD GCC extensions so that its CFLAGS are only
>   used with FreeBSD GCC.

any reason -f* flags were added to CWARNFLAGS in the first place? they aren't
really warnings, are they, so adding them to CFLAGS makes more sense imo.

how about:

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
 #

this also gets rid of some cases where double spaces occur during compilation.
that's just eye candy though.

cheers.
alex

>   
>   Approved by:	kib (mentor)
> 
> Modified:
>   head/sys/conf/kern.mk
> 
> Modified: head/sys/conf/kern.mk
> ==============================================================================
> --- head/sys/conf/kern.mk	Sun Oct 23 16:04:07 2011	(r226664)
> +++ head/sys/conf/kern.mk	Sun Oct 23 16:27:03 2011	(r226665)
> @@ -1,11 +1,21 @@
>  # $FreeBSD$
>  
> +.if ${CC:T:Mclang} != "clang"
> +FREEBSD_GCC!=	${CC} --version | grep FreeBSD || true
> +.endif
> +
>  #
>  # Warning flags for compiling the kernel and components of the kernel:
>  #
> +.if ${FREEBSD_GCC}
> +# FreeBSD extensions, 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:
> @@ -32,7 +42,7 @@ CWARNFLAGS?=	-Wall -Wredundant-decls -Wn
>  #
>  .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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111026182854.GA73322>