Date: Tue, 1 Oct 2013 21:41:42 +0200 From: Dimitry Andric <dim@FreeBSD.org> To: Luigi Rizzo <rizzo@iet.unipi.it> Cc: freebsd-current@freebsd.org Subject: Re: CLANG reports an error with %b in printf(9) Message-ID: <373DB16B-0D5B-45BC-A243-917B21F81B25@FreeBSD.org> In-Reply-To: <20131001193017.GA72967@onelab2.iet.unipi.it> References: <20131001193017.GA72967@onelab2.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Oct 1, 2013, at 21:30, Luigi Rizzo <rizzo@iet.unipi.it> 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):
>
> /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=0x%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);
>
> 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
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)
iEYEARECAAYFAlJLJYAACgkQsF6jCi4glqPMOwCcCqzTsml3jzG3vzIedurEikK0
K6QAoNDTBoJcgqtc2HXrMv4Y1WYLs/yW
=r57m
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?373DB16B-0D5B-45BC-A243-917B21F81B25>
