From owner-svn-src-projects@FreeBSD.ORG Wed Jan 28 18:36:35 2015 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B0D80F3A; Wed, 28 Jan 2015 18:36:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C85EA15; Wed, 28 Jan 2015 18:36:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0SIaZFG082403; Wed, 28 Jan 2015 18:36:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0SIaYjO082398; Wed, 28 Jan 2015 18:36:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201501281836.t0SIaYjO082398@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 28 Jan 2015 18:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r277842 - in projects/clang360-import: share/mk sys/boot/efi/libefi sys/boot/i386/libi386 sys/boot/pc98/libpc98 sys/conf X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Jan 2015 18:36:35 -0000 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 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 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