From owner-svn-src-all@freebsd.org Sat Feb 1 18:17:09 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15AB91FECA5; Sat, 1 Feb 2020 18:17:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4892P06tTTz3Mqq; Sat, 1 Feb 2020 18:17:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id CBB8E9A8F; Sat, 1 Feb 2020 18:17:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::48be:cb08:157f:a7ed] (unknown [IPv6:2001:470:7a58:0:48be:cb08:157f:a7ed]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id A69B63B4FF; Sat, 1 Feb 2020 19:17:07 +0100 (CET) From: Dimitry Andric Message-Id: <5146F5D0-6E0A-415D-8C14-AE8C5CD05CAA@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_3CBCF93B-B87C-4C73-A1B5-FE1A183EB6B4"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r357349 - in head/sys: conf modules/tpm Date: Sat, 1 Feb 2020 19:17:07 +0100 In-Reply-To: Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Ian Lepore References: <202001311936.00VJaEDP056807@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Feb 2020 18:17:09 -0000 --Apple-Mail=_3CBCF93B-B87C-4C73-A1B5-FE1A183EB6B4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 1 Feb 2020, at 18:55, Ian Lepore wrote: >=20 > On Fri, 2020-01-31 at 19:36 +0000, Dimitry Andric wrote: >> Author: dim >> Date: Fri Jan 31 19:36:14 2020 >> New Revision: 357349 >> URL: https://svnweb.freebsd.org/changeset/base/357349 >>=20 >> Log: >> Merge r357348 from the clang 10.0.0 import branch: >>=20 >> Disable new clang 10.0.0 warnings about converting the result of = shift >> operations to a boolean in tpm(4): >>=20 >> sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' = to a boolean; did you mean '(1 << (0)) !=3D 0'? = [-Werror,-Wint-in-bool-context] >> WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD); >> ^ >> sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro = 'TPM_CRB_CTRL_CANCEL_CMD' >> #define TPM_CRB_CTRL_CANCEL_CMD BIT(0) >> ^ >> sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT' >> #define BIT(x) (1 << (x)) >> ^ >>=20 >> Such warnings can be useful in C++ contexts, but not so much in = kernel >> drivers, where this type of bit twiddling is commonplace. So = disable it >> for this case. >>=20 >=20 > I think the point of the compiler warning about shift in a boolean > context is the same as warning about assignment in a boolean > context. I.e, >=20 > if (a << 3) >=20 > might be a typo for >=20 > if (a < 3) >=20 > in the same way as "a =3D 3" might have been intended to be "a =3D=3D = 3". Yes, clang inherited this warning from gcc, where it says in: = https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wint-in-bool= -context -Wint-in-bool-context Warn for suspicious use of integer values where boolean values are expected, such as conditional expressions (?:) using non-boolean integer constants in boolean context, like if (a <=3D b ? 2 : 3). Or left shifting of signed integers in boolean context, like for (a =3D = 0; 1 << a; a++);. Likewise for all kinds of multiplications regardless of the data type. This warning is enabled by -Wall. -Dimitry --Apple-Mail=_3CBCF93B-B87C-4C73-A1B5-FE1A183EB6B4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXjXAowAKCRCwXqMKLiCW o7GMAKDVh6PO3SpDC9sf6fOWLj7s9Gcd5ACg0EkRgDA8CXvK9NijozxV82TFMO4= =WC// -----END PGP SIGNATURE----- --Apple-Mail=_3CBCF93B-B87C-4C73-A1B5-FE1A183EB6B4--