kern/159278: [PATCH] FreeBSD compiler extensions

Robert Millan rmh at
Thu Jul 28 23:30:09 UTC 2011

>Number:         159278
>Category:       kern
>Synopsis:       [PATCH] FreeBSD compiler extensions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 28 23:30:08 UTC 2011
>Originator:     Robert Millan
>Release:        Debian GNU/kFreeBSD "sid"
This patch conditionalizes a pair of FreeBSD compiler extensions so
that its CFLAGS are only used on FreeBSD.

See also:



Patch attached with submission follows:

Index: sys/conf/
--- sys/conf/	(revision 223736)
+++ sys/conf/	(working copy)
@@ -1,11 +1,21 @@
 # $FreeBSD$
+.if !defined(OPSYS)
+OPSYS!=		uname -s
 # 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
 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 @@
 .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
 CFLAGS+=	-mno-aes -mno-avx


More information about the freebsd-bugs mailing list