From owner-svn-src-head@freebsd.org Fri Jan 31 22:36:29 2020 Return-Path: Delivered-To: svn-src-head@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 6116E1EF150; Fri, 31 Jan 2020 22:36:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 488XBj1sHyz4KHV; Fri, 31 Jan 2020 22:36:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (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 0F1FDC66; Fri, 31 Jan 2020 22:36:29 +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 61AA83321C; Fri, 31 Jan 2020 23:36:27 +0100 (CET) From: Dimitry Andric Message-Id: <18BC9807-4B4C-482C-AB7E-20F9C7B68F29@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_F13EF4D6-E45E-47C8-B899-5F5825D3AFFC"; 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: Fri, 31 Jan 2020 23:36:16 +0100 In-Reply-To: Cc: src-committers , svn-src-all , svn-src-head To: cem@freebsd.org References: <202001311936.00VJaEDP056807@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jan 2020 22:36:29 -0000 --Apple-Mail=_F13EF4D6-E45E-47C8-B899-5F5825D3AFFC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hmm yes, you are quite right. Other parts of the code also seem to use = ~TPM_XXX, and the WR4() inline function called takes a uint32_t. I'll = revert my change and apply the tilde version instead! -Dimitry > On 31 Jan 2020, at 22:13, Conrad Meyer wrote: >=20 > Hi Dimitry, >=20 > Do you think maybe the intent is to use ~TPM_CRB_CTRL_CANCEL_CMD > instead? Plain "0" might also make sense. But I think the compiler > is right here and the warning should not be disabled =E2=80=94 = !BIT(foo) > doesn't really make sense for a register. It happens to affect the > right bit only because CANCEL_CMD is BIT(0). >=20 > Thanks, > Conrad >=20 > On Fri, Jan 31, 2020 at 11:36 AM Dimitry Andric = wrote: >>=20 >> 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 >> MFC after: 3 days >>=20 >> Modified: >> head/sys/conf/files.amd64 >> head/sys/conf/kern.mk >> head/sys/modules/tpm/Makefile >> Directory Properties: >> head/ (props changed) >>=20 >> Modified: head/sys/conf/files.amd64 >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/conf/files.amd64 Fri Jan 31 19:35:21 2020 = (r357348) >> +++ head/sys/conf/files.amd64 Fri Jan 31 19:36:14 2020 = (r357349) >> @@ -323,7 +323,8 @@ dev/syscons/scvesactl.c optional = sc vga vesa >> dev/syscons/scvgarndr.c optional sc vga >> dev/tpm/tpm.c optional tpm >> dev/tpm/tpm20.c optional tpm >> -dev/tpm/tpm_crb.c optional tpm acpi >> +dev/tpm/tpm_crb.c optional tpm acpi \ >> + compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}" >> dev/tpm/tpm_tis.c optional tpm acpi >> dev/tpm/tpm_acpi.c optional tpm acpi >> dev/tpm/tpm_isa.c optional tpm isa >>=20 >> Modified: head/sys/conf/kern.mk >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/conf/kern.mk Fri Jan 31 19:35:21 2020 = (r357348) >> +++ head/sys/conf/kern.mk Fri Jan 31 19:36:14 2020 = (r357349) >> @@ -37,6 +37,9 @@ CWARNEXTRA+=3D -Wno-error-shift-negative-value >> .if ${COMPILER_VERSION} >=3D 40000 >> CWARNEXTRA+=3D -Wno-address-of-packed-member >> .endif >> +.if ${COMPILER_VERSION} >=3D 100000 >> +NO_WINT_IN_BOOL_CONTEXT=3D -Wno-int-in-bool-context >> +.endif >> .endif >>=20 >> .if ${COMPILER_TYPE} =3D=3D "gcc" >>=20 >> Modified: head/sys/modules/tpm/Makefile >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/modules/tpm/Makefile Fri Jan 31 19:35:21 2020 = (r357348) >> +++ head/sys/modules/tpm/Makefile Fri Jan 31 19:36:14 2020 = (r357349) >> @@ -11,3 +11,5 @@ SRCS+=3D tpm_isa.c tpm_acpi.c isa_if.h = opt_acpi.h acpi_i >> SRCS+=3D tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h >>=20 >> .include >> + >> +CWARNFLAGS.tpm_crb.c+=3D ${NO_WINT_IN_BOOL_CONTEXT} --Apple-Mail=_F13EF4D6-E45E-47C8-B899-5F5825D3AFFC 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 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXjSr4QAKCRCwXqMKLiCW o3XXAJ97t4dhBRO3clHnB9hw+3t3kEwg9gCgv52T1MfE79SYmY8zjMLT7Sv1u38= =EygU -----END PGP SIGNATURE----- --Apple-Mail=_F13EF4D6-E45E-47C8-B899-5F5825D3AFFC--