Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jan 2020 23:36:16 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        cem@freebsd.org
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r357349 - in head/sys: conf modules/tpm
Message-ID:  <18BC9807-4B4C-482C-AB7E-20F9C7B68F29@FreeBSD.org>
In-Reply-To: <CAG6CVpWy%2BA3MN47GyLoL5jvdT7pMABevg-L9w0o7HpZF9Vq5oQ@mail.gmail.com>
References:  <202001311936.00VJaEDP056807@repo.freebsd.org> <CAG6CVpWy%2BA3MN47GyLoL5jvdT7pMABevg-L9w0o7HpZF9Vq5oQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--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 <cem@FreeBSD.org> 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 <dim@freebsd.org> =
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 <bsd.kmod.mk>
>> +
>> +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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18BC9807-4B4C-482C-AB7E-20F9C7B68F29>