[haiku-bugs] [Haiku] #12991: [Patch] KeyboardInputDevice.cpp: Fix int-in-bool-context warning

  • From: "mt" <trac@xxxxxxxxxxxx>
  • Date: Thu, 06 Oct 2016 11:26:35 -0000

#12991: [Patch] KeyboardInputDevice.cpp: Fix int-in-bool-context warning
----------------------------------+------------------------------
 Reporter:  mt                    |        Owner:  nobody
     Type:  bug                   |       Status:  new
 Priority:  normal                |    Milestone:  Unscheduled
Component:  Servers/input_server  |      Version:  R1/Development
 Keywords:                        |   Blocked By:
 Blocking:                        |  Has a Patch:  0
 Platform:  All                   |
----------------------------------+------------------------------
 Gcc7 reports "-Werror=int-in-bool-context" at line 343. Since "1 << (7 -
 (keycode & 0x7)" is always > 0 (true), I think it would be better to use
 bitwise NOT than logical NOT.

 {{{
 /home/haiku/haiku/haiku/src/add-
 ons/input_server/devices/keyboard/KeyboardInputDevice.cpp:343:36: error:
 << in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
      states[(keycode) >> 3] &= (!(1 << (7 - (keycode & 0x7))));
                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
 }}}

--
Ticket URL: <https://dev.haiku-os.org/ticket/12991>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: