Opened 3 years ago

Closed 3 years ago

#12991 closed bug (fixed)

[Patch] KeyboardInputDevice.cpp: Fix int-in-bool-context warning

Reported by: mt Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Servers/input_server Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: yes Platform: All

Description

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))));
                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~

Attachments (1)

0033-KeyboardInputDevice.cpp-Fix-int-in-bool-context-warn.patch (1016 bytes ) - added by mt 3 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 by mt, 3 years ago

Has a Patch: set

comment:2 by pulkomandy, 3 years ago

Resolution: fixed
Status: newclosed

Applied in hrev50585.

Note: See TracTickets for help on using tickets.