From owner-freebsd-current@FreeBSD.ORG Tue Oct 1 19:41:57 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 10893C37 for ; Tue, 1 Oct 2013 19:41:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C4C6C23FC for ; Tue, 1 Oct 2013 19:41:56 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::7db3:6a4:b6c0:7094] (unknown [IPv6:2001:7b8:3a7:0:7db3:6a4:b6c0:7094]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id C59FA5C44; Tue, 1 Oct 2013 21:41:54 +0200 (CEST) Content-Type: multipart/signed; boundary="Apple-Mail=_F37959E8-E3A4-4C85-8EA2-3F473D7FF6CA"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: CLANG reports an error with %b in printf(9) From: Dimitry Andric In-Reply-To: <20131001193017.GA72967@onelab2.iet.unipi.it> Date: Tue, 1 Oct 2013 21:41:42 +0200 Message-Id: <373DB16B-0D5B-45BC-A243-917B21F81B25@FreeBSD.org> References: <20131001193017.GA72967@onelab2.iet.unipi.it> To: Luigi Rizzo X-Mailer: Apple Mail (2.1510) Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Oct 2013 19:41:57 -0000 --Apple-Mail=_F37959E8-E3A4-4C85-8EA2-3F473D7FF6CA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Oct 1, 2013, at 21:30, Luigi Rizzo wrote: > This is on HEAD -- while compiling the kernel with CLANG and slightly > higher warns level, i get errors of this kind (in multiple places): >=20 > /usr/home/luigi/FreeBSD/head/sys/cam/cam_xpt.c:1069:27: error: invalid = conversion specifier > 'b' [-Werror,-Wformat-invalid-specifier] > printf("%s%d: quirks=3D0x%b\n", periph->periph_name, > ~^ > /usr/home/luigi/FreeBSD/head/sys/cam/cam_xpt.c:1070:36: error: data = argument not used by > format string [-Werror,-Wformat-extra-args] > periph->unit_number, quirks, bit_string); >=20 > Does anyone know how hard it is to either disable the warning locally > (for a statement, function or file), or better to teach CLANG that > printf(9) uses two arguments for %b ? Hi Luigi, It looks like you are overriding CWARNFLAGS? If you are using clang from base, you can add -fformat-extensions, which has support for our non-standard %b and %D specifiers. For clang from ports, there is no solution except -Wno-format. See also the start of sys/conf/kern.mk. -Dimitry --Apple-Mail=_F37959E8-E3A4-4C85-8EA2-3F473D7FF6CA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.20 (Darwin) iEYEARECAAYFAlJLJYAACgkQsF6jCi4glqPMOwCcCqzTsml3jzG3vzIedurEikK0 K6QAoNDTBoJcgqtc2HXrMv4Y1WYLs/yW =r57m -----END PGP SIGNATURE----- --Apple-Mail=_F37959E8-E3A4-4C85-8EA2-3F473D7FF6CA--