From owner-freebsd-testing@FreeBSD.ORG Fri Feb 7 18:04:43 2014 Return-Path: Delivered-To: freebsd-testing@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 ESMTPS id 77CE52C3; Fri, 7 Feb 2014 18:04:43 +0000 (UTC) Received: from mail-we0-x231.google.com (mail-we0-x231.google.com [IPv6:2a00:1450:400c:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7343618C9; Fri, 7 Feb 2014 18:04:42 +0000 (UTC) Received: by mail-we0-f177.google.com with SMTP id t61so2473553wes.8 for ; Fri, 07 Feb 2014 10:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=EPpHZRIQns5b3v4l/FKGuYGgGk1Tzn3yj7YN5zKlXvc=; b=mddps6Oy3IWm11exk4AusBBdLCZdM1ZxZ7Le87b8ozxtt0NpDTEvdc526oJKN4SqLu yAS/CYc9cDWuKuEwBevZCRotDo9b1OUPh7THhnmKdQgKPl4XyVg19ZgqIKPHD8mfo6A9 U0ziuBP8W5MTyM285ataU9I/Et85IFTIFsiP/VKiP0NDCXzQ+VRCXSVe5ThhMKrhx0Ee 5VM8BFtTUYfFmoBatfkDTDbD+85DN9GdtE+ewLHYaRKZLiXRhGZxmPWnQPAanCPFFejV 0nMXkBNx7ZMRn/yPZhNpPuwYCxdWdQVRyrsT4IGYxcQbetl4pd+ltnrNet3rnNDSkgnr R9kQ== MIME-Version: 1.0 X-Received: by 10.194.63.228 with SMTP id j4mr11907621wjs.34.1391796280784; Fri, 07 Feb 2014 10:04:40 -0800 (PST) Sender: asomers@gmail.com Received: by 10.194.168.197 with HTTP; Fri, 7 Feb 2014 10:04:40 -0800 (PST) Date: Fri, 7 Feb 2014 11:04:40 -0700 X-Google-Sender-Auth: cZVPRDvroqnToXM8gnRB5I2H6nM Message-ID: Subject: contrib/libc++/include/locale contains -Wsign-compare errors From: Alan Somers To: FreeBSD CURRENT , "freebsd-testing@freebsd.org" , theraven@freebsd.org, Brooks Davis , Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Feb 2014 18:04:43 -0000 contrib/libc++/include/locale compares integers of different signs. With our CXXFLAG settings, this causes "WITH_TESTS=1 make buildworld" to fail while compiling libatf-c++, as I mentioned in another thread. I've now written a minimal test case. Just #include locale and compile it with the right settings. $ cat use_locale.cpp #include $ c++ -Wsystem-headers -Werror -Wsign-compare -Wno-unused-parameter -Wno-c++11-extensions -c -o use_locale.o use_locale.cpp In file included from use_locale.cpp:1: /usr/include/c++/v1/locale:1016:27: error: comparison of integers of different signs: 'long' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare] if (__a_end - __a == __buf.size()) ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ /usr/include/c++/v1/locale:1066:27: error: comparison of integers of different signs: 'long' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare] if (__a_end - __a == __buf.size()) ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ /usr/include/c++/v1/locale:1120:27: error: comparison of integers of different signs: 'long' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare] if (__a_end - __a == __buf.size()) ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ 3 errors generated. The below patch fixes the problem, but I don't have the confidence to change the system C++ library myself. Can somebody please review it? Index: contrib/libc++/include/locale =================================================================== --- contrib/libc++/include/locale (revision 261283) +++ contrib/libc++/include/locale (working copy) @@ -1012,7 +1012,7 @@ unsigned __dc = 0; for (; __b != __e; ++__b) { - if (__a_end - __a == __buf.size()) + if ((size_t)(__a_end - __a) == __buf.size()) { size_t __tmp = __buf.size(); __buf.resize(2*__buf.size()); @@ -1062,7 +1062,7 @@ unsigned __dc = 0; for (; __b != __e; ++__b) { - if (__a_end - __a == __buf.size()) + if ((size_t)(__a_end - __a) == __buf.size()) { size_t __tmp = __buf.size(); __buf.resize(2*__buf.size()); @@ -1116,7 +1116,7 @@ char __exp = 'E'; for (; __b != __e; ++__b) { - if (__a_end - __a == __buf.size()) + if ((size_t)(__a_end - __a) == __buf.size()) { size_t __tmp = __buf.size(); __buf.resize(2*__buf.size()); From owner-freebsd-testing@FreeBSD.ORG Fri Feb 7 21:19:54 2014 Return-Path: Delivered-To: freebsd-testing@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 416A268C; Fri, 7 Feb 2014 21:19:54 +0000 (UTC) Received: from tensor.andric.com (unknown [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EB31C19E7; Fri, 7 Feb 2014 21:19:53 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7::9502:12a8:3deb:47e] (unknown [IPv6:2001:7b8:3a7:0:9502:12a8:3deb:47e]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 8D5AA5C44; Fri, 7 Feb 2014 22:19:50 +0100 (CET) Subject: Re: contrib/libc++/include/locale contains -Wsign-compare errors Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Content-Type: multipart/signed; boundary="Apple-Mail=_F5EB2442-8888-41C9-8BD9-71FBEC52AE3D"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.1 (6062eb4) From: Dimitry Andric In-Reply-To: Date: Fri, 7 Feb 2014 22:19:41 +0100 Message-Id: <5FD73D01-F8E4-42F8-B5A6-67A6BD516A08@FreeBSD.org> References: To: Alan Somers X-Mailer: Apple Mail (2.1827) Cc: "freebsd-testing@freebsd.org" , FreeBSD CURRENT , theraven@freebsd.org, Brooks Davis X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Feb 2014 21:19:54 -0000 --Apple-Mail=_F5EB2442-8888-41C9-8BD9-71FBEC52AE3D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On 07 Feb 2014, at 19:04, Alan Somers wrote: ... > In file included from use_locale.cpp:1: > /usr/include/c++/v1/locale:1016:27: error: comparison of integers of = different > signs: 'long' and 'size_type' (aka 'unsigned long') > [-Werror,-Wsign-compare] > if (__a_end - __a =3D=3D __buf.size()) > ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ Fixed in r261608 (in a somewhat cleaner way than r261604). It's also going to be applied upstream. -Dimitry --Apple-Mail=_F5EB2442-8888-41C9-8BD9-71FBEC52AE3D 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.22 (Darwin) iEYEARECAAYFAlL1Te0ACgkQsF6jCi4glqMwXwCgz796JqT8UBvbiTs8meGm02B8 gTwAoMOjPc15ucvhUUoeaP/O3XxCb/V3 =AlND -----END PGP SIGNATURE----- --Apple-Mail=_F5EB2442-8888-41C9-8BD9-71FBEC52AE3D--