svn commit: r277842 - in projects/clang360-import: share/mk sys/boot/efi/libefi sys/boot/i386/libi386 sys/boot/pc98/libpc98 sys/conf
Dimitry Andric
dim at FreeBSD.org
Wed Jan 28 18:36:35 UTC 2015
Author: dim
Date: Wed Jan 28 18:36:33 2015
New Revision: 277842
URL: https://svnweb.freebsd.org/changeset/base/277842
Log:
Since clang 3.6.0 now implements the archetype 'freebsd_kprintf' for
__attribute__((format(...))), and the -fformat-extensions flag was
removed, introduce a new macro in bsd.sys.mk to choose the right variant
of compile flag for the used compiler, and use it.
Also add something similar to kern.mk, since including bsd.sys.mk from
that file will anger Warner. :-)
Note that bsd.sys.mk does not support the MK_FORMAT_EXTENSIONS knob used
in kern.mk, since that knob is only available in kern.opts.mk, not in
src.opts.mk. We might want to add it later, to more easily support
external compilers for building world (in particular, sys/boot).
Modified:
projects/clang360-import/share/mk/bsd.sys.mk
projects/clang360-import/sys/boot/efi/libefi/Makefile
projects/clang360-import/sys/boot/i386/libi386/Makefile
projects/clang360-import/sys/boot/pc98/libpc98/Makefile
projects/clang360-import/sys/conf/kern.mk
Modified: projects/clang360-import/share/mk/bsd.sys.mk
==============================================================================
--- projects/clang360-import/share/mk/bsd.sys.mk Wed Jan 28 18:19:25 2015 (r277841)
+++ projects/clang360-import/share/mk/bsd.sys.mk Wed Jan 28 18:36:33 2015 (r277842)
@@ -109,6 +109,13 @@ CWARNFLAGS+= -Werror
CWARNFLAGS+= -Wno-format
.endif # NO_WFORMAT || NO_WFORMAT.${COMPILER_TYPE}
+# How to handle FreeBSD custom printf format specifiers.
+.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
+FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
+.else
+FORMAT_EXTENSIONS= -fformat-extensions
+.endif
+
.if defined(IGNORE_PRAGMA)
CWARNFLAGS+= -Wno-unknown-pragmas
.endif # IGNORE_PRAGMA
Modified: projects/clang360-import/sys/boot/efi/libefi/Makefile
==============================================================================
--- projects/clang360-import/sys/boot/efi/libefi/Makefile Wed Jan 28 18:19:25 2015 (r277841)
+++ projects/clang360-import/sys/boot/efi/libefi/Makefile Wed Jan 28 18:36:33 2015 (r277842)
@@ -20,8 +20,7 @@ CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -DNO_PCI
-
-# Suppress warning from clang for FreeBSD %b and %D formats
-CFLAGS+= -fformat-extensions
+# Handle FreeBSD specific %b and %D printf format specifiers
+CFLAGS+= ${FORMAT_EXTENSIONS}
.include <bsd.lib.mk>
Modified: projects/clang360-import/sys/boot/i386/libi386/Makefile
==============================================================================
--- projects/clang360-import/sys/boot/i386/libi386/Makefile Wed Jan 28 18:19:25 2015 (r277841)
+++ projects/clang360-import/sys/boot/i386/libi386/Makefile Wed Jan 28 18:36:33 2015 (r277842)
@@ -55,8 +55,8 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.
# the location of libstand
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
-# Suppress warning from clang for FreeBSD %b and %D formats
-CFLAGS+= -fformat-extensions
+# Handle FreeBSD specific %b and %D printf format specifiers
+CFLAGS+= ${FORMAT_EXTENSIONS}
.if ${MACHINE_CPUARCH} == "amd64"
CLEANFILES+= machine
Modified: projects/clang360-import/sys/boot/pc98/libpc98/Makefile
==============================================================================
--- projects/clang360-import/sys/boot/pc98/libpc98/Makefile Wed Jan 28 18:19:25 2015 (r277841)
+++ projects/clang360-import/sys/boot/pc98/libpc98/Makefile Wed Jan 28 18:36:33 2015 (r277842)
@@ -44,7 +44,7 @@ CFLAGS+= -I${.CURDIR}/../../common \
# the location of libstand
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
-# Suppress warning from clang for FreeBSD %b and %D formats
-CFLAGS+= -fformat-extensions
+# Handle FreeBSD specific %b and %D printf format specifiers
+CFLAGS+= ${FORMAT_EXTENSIONS}
.include <bsd.lib.mk>
Modified: projects/clang360-import/sys/conf/kern.mk
==============================================================================
--- projects/clang360-import/sys/conf/kern.mk Wed Jan 28 18:19:25 2015 (r277841)
+++ projects/clang360-import/sys/conf/kern.mk Wed Jan 28 18:36:33 2015 (r277842)
@@ -58,6 +58,8 @@ CWARNEXTRA?= -Wno-uninitialized
# to be disabled. WARNING: format checking is disabled in this case.
.if ${MK_FORMAT_EXTENSIONS} == "no"
FORMAT_EXTENSIONS= -Wno-format
+.elif ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
+FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
.else
FORMAT_EXTENSIONS= -fformat-extensions
.endif
More information about the svn-src-projects
mailing list