Re: svn commit: r357349 - in head/sys: conf modules/tpm

2020-02-01 Thread Conrad Meyer
Hi Dimitry,

On Sat, Feb 1, 2020 at 12:29 PM Conrad Meyer  wrote:
> Please un-disable the Makefile warnings removed in r357349 earlier, too.

Apologies, I just now caught up to my r357366 in my SVN email.  Thank you.

Best,
Conrad
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r357349 - in head/sys: conf modules/tpm

2020-02-01 Thread Conrad Meyer
On Sat, Feb 1, 2020 at 10:10 AM Dimitry Andric  wrote:
>
> On 1 Feb 2020, at 18:48, Ian Lepore  wrote:
> >
> > So you're going to switch from writing 0 to writing 0xfffe, and
> > just assume that will work the same?
> > ... [Caustic sarcasm elided]
>
> Hmm, the data sheet says:
>
> Writes ( 0001h): Cancel a command
> Writes ( h): Clears field when command has been cancelled
>
> It seems the other bits in the register are not used for anything.

This seems pretty typical for TPM registers (in my limited experience).

> So indeed it is probably better to explicitly define these values as 0x0
> and 0x1, and not use ~ or ! operators at all.

I would suggest using just a plain 0 for the clear-cancel register
write, unless the other bits are actually documented to have meaning,
and that meaning is not W1C.  My recollection is that many TPM
registers only have a single real valid bit, and of those that have
more than one, many are W1C.  (AND4/OR4 RMW are inappropriate for
W1C.)  We have at least one AND4/OR4 related bugfix pending in
phabricator related to this that I should go ahead and commit:
https://reviews.freebsd.org/D23081 .

I don't think the ~0x1 (0xff...fe) will actually do anything harmful
if the other bits are ignore.  But 0 is closer to the data sheet.

Please un-disable the Makefile warnings removed in r357349 earlier, too.

Thanks,
Conrad
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r357349 - in head/sys: conf modules/tpm

2020-02-01 Thread Dimitry Andric
On 1 Feb 2020, at 18:55, Ian Lepore  wrote:
> 
> On Fri, 2020-01-31 at 19:36 +, Dimitry Andric wrote:
>> Author: dim
>> Date: Fri Jan 31 19:36:14 2020
>> New Revision: 357349
>> URL: https://svnweb.freebsd.org/changeset/base/357349
>> 
>> Log:
>>  Merge r357348 from the clang 10.0.0 import branch:
>> 
>>  Disable new clang 10.0.0 warnings about converting the result of shift
>>  operations to a boolean in tpm(4):
>> 
>>  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a 
>> boolean; did you mean '(1 << (0)) != 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))
>>^
>> 
>>  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.
>> 
> 
> 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,
> 
>   if (a << 3)
> 
> might be a typo for
> 
>   if (a < 3)
> 
> in the same way as "a = 3" might have been intended to be "a == 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 <= b ? 2 : 3). Or
  left shifting of signed integers in boolean context, like for (a = 0;
  1 << a; a++);. Likewise for all kinds of multiplications regardless of
  the data type. This warning is enabled by -Wall.

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r357349 - in head/sys: conf modules/tpm

2020-02-01 Thread Dimitry Andric
On 1 Feb 2020, at 18:48, Ian Lepore  wrote:
> 
> On Fri, 2020-01-31 at 23:36 +0100, Dimitry Andric wrote:
>> 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
>> 
> 
> So you're going to switch from writing 0 to writing 0xfffe, and
> just assume that will work the same?  Like, without looking at the
> datasheet or TRM for the device?  Surely those other 31 bits you're
> turning on in a control register can't do anything important, can they?

Hmm, the data sheet says:

Writes ( 0001h): Cancel a command
Writes ( h): Clears field when command has been cancelled

It seems the other bits in the register are not used for anything.

So indeed it is probably better to explicitly define these values as 0x0
and 0x1, and not use ~ or ! operators at all.


> I haven't looked at the code, but I'll bet the other places that are
> using ~SYMBOLNAME are doing so in the context of read-modify-write in a
> way that preserves existing bits, which is completely different than
> just turning on 31 bits as a side effect of turning one bit off.

There aren't many places, but they tend to use the AND4() and OR4()
inline functions, which do are more usual pattern of read-modify-write.

I'll fix up the code again...

-Dimitry



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r357349 - in head/sys: conf modules/tpm

2020-02-01 Thread Ian Lepore
On Fri, 2020-01-31 at 19:36 +, Dimitry Andric wrote:
> Author: dim
> Date: Fri Jan 31 19:36:14 2020
> New Revision: 357349
> URL: https://svnweb.freebsd.org/changeset/base/357349
> 
> Log:
>   Merge r357348 from the clang 10.0.0 import branch:
>   
>   Disable new clang 10.0.0 warnings about converting the result of shift
>   operations to a boolean in tpm(4):
>   
>   sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a 
> boolean; did you mean '(1 << (0)) != 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))
> ^
>   
>   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.
>   

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,

   if (a << 3)

might be a typo for 

   if (a < 3)

in the same way as "a = 3" might have been intended to be "a == 3".

When this type of bit twiddling is used in drivers, it's almost always
combined with an & or | operator, which I assume the compiler then
won't complain about (or you would have seen thousands of warnings
while compiling in dev/*).

-- Ian


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r357349 - in head/sys: conf modules/tpm

2020-02-01 Thread Ian Lepore
On Fri, 2020-01-31 at 23:36 +0100, Dimitry Andric wrote:
> 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
> 

So you're going to switch from writing 0 to writing 0xfffe, and
just assume that will work the same?  Like, without looking at the
datasheet or TRM for the device?  Surely those other 31 bits you're
turning on in a control register can't do anything important, can they?

I haven't looked at the code, but I'll bet the other places that are
using ~SYMBOLNAME are doing so in the context of read-modify-write in a
way that preserves existing bits, which is completely different than
just turning on 31 bits as a side effect of turning one bit off.

-- Ian



> > On 31 Jan 2020, at 22:13, Conrad Meyer  wrote:
> > 
> > Hi Dimitry,
> > 
> > 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 — !BIT(foo)
> > doesn't really make sense for a register.  It happens to affect the
> > right bit only because CANCEL_CMD is BIT(0).
> > 
> > Thanks,
> > Conrad
> > 
> > On Fri, Jan 31, 2020 at 11:36 AM Dimitry Andric 
> > wrote:
> > > 
> > > Author: dim
> > > Date: Fri Jan 31 19:36:14 2020
> > > New Revision: 357349
> > > URL: https://svnweb.freebsd.org/changeset/base/357349
> > > 
> > > Log:
> > >  Merge r357348 from the clang 10.0.0 import branch:
> > > 
> > >  Disable new clang 10.0.0 warnings about converting the result of
> > > shift
> > >  operations to a boolean in tpm(4):
> > > 
> > >  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of
> > > '<<' to a boolean; did you mean '(1 << (0)) != 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))
> > >^
> > > 
> > >  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.
> > > 
> > >  MFC after:3 days
> > > 
> > > Modified:
> > >  head/sys/conf/files.amd64
> > >  head/sys/conf/kern.mk
> > >  head/sys/modules/tpm/Makefile
> > > Directory Properties:
> > >  head/   (props changed)
> > > 
> > > Modified: head/sys/conf/files.amd64
> > > =
> > > =
> > > --- 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 optionalsc vga vesa
> > > dev/syscons/scvgarndr.coptionalsc vga
> > > dev/tpm/tpm.c  optionaltpm
> > > dev/tpm/tpm20.coptionaltpm
> > > -dev/tpm/tpm_crb.c  optionaltpm acpi
> > > +dev/tpm/tpm_crb.c  optionaltpm acpi \
> > > +   compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}"
> > > dev/tpm/tpm_tis.c  optionaltpm acpi
> > > dev/tpm/tpm_acpi.c optionaltpm acpi
> > > dev/tpm/tpm_isa.c  optionaltpm isa
> > > 
> > > Modified: head/sys/conf/kern.mk
> > > =
> > > =
> > > --- 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+=  -Wno-error-shift-negative-value
> > > .if ${COMPILER_VERSION} >= 4
> > > CWARNEXTRA+=   -Wno-address-of-packed-member
> > > .endif
> > > +.if ${COMPILER_VERSION} >= 10
> > > +NO_WINT_IN_BOOL_CONTEXT=   -Wno-int-in-bool-context
> > > +.endif
> > > .endif
> > > 
> > > .if ${COMPILER_TYPE} == "gcc"
> > > 
> > > Modified: head/sys/modules/tpm/Makefile
> > > =
> > > =
> > > --- 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+=tpm_isa.c tpm_acpi.c isa_if.h
> > > opt_acpi.h acpi_i
> > > SRCS+= tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h
> > > 
> > > .include 
> > > +
> > > +CWARNFLAGS.tpm_crb.c+= ${NO_WINT_IN_BOOL_CONTEXT}
> 
> 


___

Re: svn commit: r357349 - in head/sys: conf modules/tpm

2020-01-31 Thread Dimitry Andric
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:
> 
> Hi Dimitry,
> 
> 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 — !BIT(foo)
> doesn't really make sense for a register.  It happens to affect the
> right bit only because CANCEL_CMD is BIT(0).
> 
> Thanks,
> Conrad
> 
> On Fri, Jan 31, 2020 at 11:36 AM Dimitry Andric  wrote:
>> 
>> Author: dim
>> Date: Fri Jan 31 19:36:14 2020
>> New Revision: 357349
>> URL: https://svnweb.freebsd.org/changeset/base/357349
>> 
>> Log:
>>  Merge r357348 from the clang 10.0.0 import branch:
>> 
>>  Disable new clang 10.0.0 warnings about converting the result of shift
>>  operations to a boolean in tpm(4):
>> 
>>  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a 
>> boolean; did you mean '(1 << (0)) != 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))
>>^
>> 
>>  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.
>> 
>>  MFC after:3 days
>> 
>> Modified:
>>  head/sys/conf/files.amd64
>>  head/sys/conf/kern.mk
>>  head/sys/modules/tpm/Makefile
>> Directory Properties:
>>  head/   (props changed)
>> 
>> Modified: head/sys/conf/files.amd64
>> ==
>> --- 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 optionalsc 
>> vga vesa
>> dev/syscons/scvgarndr.coptionalsc vga
>> dev/tpm/tpm.c  optionaltpm
>> dev/tpm/tpm20.coptionaltpm
>> -dev/tpm/tpm_crb.c  optionaltpm acpi
>> +dev/tpm/tpm_crb.c  optionaltpm acpi \
>> +   compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}"
>> dev/tpm/tpm_tis.c  optionaltpm acpi
>> dev/tpm/tpm_acpi.c optionaltpm acpi
>> dev/tpm/tpm_isa.c  optionaltpm isa
>> 
>> Modified: head/sys/conf/kern.mk
>> ==
>> --- 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+=  -Wno-error-shift-negative-value
>> .if ${COMPILER_VERSION} >= 4
>> CWARNEXTRA+=   -Wno-address-of-packed-member
>> .endif
>> +.if ${COMPILER_VERSION} >= 10
>> +NO_WINT_IN_BOOL_CONTEXT=   -Wno-int-in-bool-context
>> +.endif
>> .endif
>> 
>> .if ${COMPILER_TYPE} == "gcc"
>> 
>> Modified: head/sys/modules/tpm/Makefile
>> ==
>> --- 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+=tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h 
>> acpi_i
>> SRCS+= tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h
>> 
>> .include 
>> +
>> +CWARNFLAGS.tpm_crb.c+= ${NO_WINT_IN_BOOL_CONTEXT}



signature.asc
Description: Message signed with OpenPGP


Re: svn commit: r357349 - in head/sys: conf modules/tpm

2020-01-31 Thread Conrad Meyer
Hi Dimitry,

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 — !BIT(foo)
doesn't really make sense for a register.  It happens to affect the
right bit only because CANCEL_CMD is BIT(0).

Thanks,
Conrad

On Fri, Jan 31, 2020 at 11:36 AM Dimitry Andric  wrote:
>
> Author: dim
> Date: Fri Jan 31 19:36:14 2020
> New Revision: 357349
> URL: https://svnweb.freebsd.org/changeset/base/357349
>
> Log:
>   Merge r357348 from the clang 10.0.0 import branch:
>
>   Disable new clang 10.0.0 warnings about converting the result of shift
>   operations to a boolean in tpm(4):
>
>   sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a 
> boolean; did you mean '(1 << (0)) != 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))
> ^
>
>   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.
>
>   MFC after:3 days
>
> Modified:
>   head/sys/conf/files.amd64
>   head/sys/conf/kern.mk
>   head/sys/modules/tpm/Makefile
> Directory Properties:
>   head/   (props changed)
>
> Modified: head/sys/conf/files.amd64
> ==
> --- 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 optionalsc 
> vga vesa
>  dev/syscons/scvgarndr.coptionalsc vga
>  dev/tpm/tpm.c  optionaltpm
>  dev/tpm/tpm20.coptionaltpm
> -dev/tpm/tpm_crb.c  optionaltpm acpi
> +dev/tpm/tpm_crb.c  optionaltpm acpi \
> +   compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}"
>  dev/tpm/tpm_tis.c  optionaltpm acpi
>  dev/tpm/tpm_acpi.c optionaltpm acpi
>  dev/tpm/tpm_isa.c  optionaltpm isa
>
> Modified: head/sys/conf/kern.mk
> ==
> --- 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+=  -Wno-error-shift-negative-value
>  .if ${COMPILER_VERSION} >= 4
>  CWARNEXTRA+=   -Wno-address-of-packed-member
>  .endif
> +.if ${COMPILER_VERSION} >= 10
> +NO_WINT_IN_BOOL_CONTEXT=   -Wno-int-in-bool-context
> +.endif
>  .endif
>
>  .if ${COMPILER_TYPE} == "gcc"
>
> Modified: head/sys/modules/tpm/Makefile
> ==
> --- 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+=tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h 
> acpi_i
>  SRCS+= tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h
>
>  .include 
> +
> +CWARNFLAGS.tpm_crb.c+= ${NO_WINT_IN_BOOL_CONTEXT}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r357349 - in head/sys: conf modules/tpm

2020-01-31 Thread Dimitry Andric
Author: dim
Date: Fri Jan 31 19:36:14 2020
New Revision: 357349
URL: https://svnweb.freebsd.org/changeset/base/357349

Log:
  Merge r357348 from the clang 10.0.0 import branch:
  
  Disable new clang 10.0.0 warnings about converting the result of shift
  operations to a boolean in tpm(4):
  
  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a 
boolean; did you mean '(1 << (0)) != 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))
^
  
  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.
  
  MFC after:3 days

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/kern.mk
  head/sys/modules/tpm/Makefile
Directory Properties:
  head/   (props changed)

Modified: head/sys/conf/files.amd64
==
--- 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 optionalsc vga 
vesa
 dev/syscons/scvgarndr.coptionalsc vga
 dev/tpm/tpm.c  optionaltpm
 dev/tpm/tpm20.coptionaltpm
-dev/tpm/tpm_crb.c  optionaltpm acpi
+dev/tpm/tpm_crb.c  optionaltpm acpi \
+   compile-with "${NORMAL_C} ${NO_WINT_IN_BOOL_CONTEXT}"
 dev/tpm/tpm_tis.c  optionaltpm acpi
 dev/tpm/tpm_acpi.c optionaltpm acpi
 dev/tpm/tpm_isa.c  optionaltpm isa

Modified: head/sys/conf/kern.mk
==
--- 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+=  -Wno-error-shift-negative-value
 .if ${COMPILER_VERSION} >= 4
 CWARNEXTRA+=   -Wno-address-of-packed-member
 .endif
+.if ${COMPILER_VERSION} >= 10
+NO_WINT_IN_BOOL_CONTEXT=   -Wno-int-in-bool-context
+.endif
 .endif
 
 .if ${COMPILER_TYPE} == "gcc"

Modified: head/sys/modules/tpm/Makefile
==
--- 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+=tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h acpi_i
 SRCS+= tpm20.c tpm_crb.c tpm_tis.c opt_tpm.h
 
 .include 
+
+CWARNFLAGS.tpm_crb.c+= ${NO_WINT_IN_BOOL_CONTEXT}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"