Re: [PATCH] platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 18, 2021 at 7:00 PM Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
>
> For what it's worth, the suggested fix is the '||' underneath the
> warning text:
>
> In file included from arch/x86/kvm/mmu/tdp_iter.c:5:
> arch/x86/kvm/mmu/spte.h:318:9: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
>         return __is_bad_mt_xwr(rsvd_check, spte) |
>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                                                  ||
> arch/x86/kvm/mmu/spte.h:318:9: note: cast one or both operands to int to silence this warning
> 1 error generated.

Hmm. That's not at all obvious.

The *much* bigger part is that

   note: cast one or both operands to int to silence this warning

which is what I'm complaining about. That note should die. It should
say "maybe you meant to use a logical or" or something like that.

> Perhaps that hint should also be added to the warning text, like:
>
> In file included from arch/x86/kvm/mmu/tdp_iter.c:5:
> arch/x86/kvm/mmu/spte.h:318:9: error: use of bitwise '|' with boolean operands; did you mean logical '||'? [-Werror,-Wbitwise-instead-of-logical]
>         return __is_bad_mt_xwr(rsvd_check, spte) |
>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                                                  ||
> arch/x86/kvm/mmu/spte.h:318:9: note: cast one or both operands to int to silence this warning

I don't understand why you seem to continue to ignore the "note"
message, which makes a completely crazy suggestion.

                 Linus



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux