Project

General

Profile

Actions

Bug #3584

closed

libosmovty/command.c: (!elem->attr & CMD_ATTR_DEPRECATED), missing parentheses?

Added by fixeria over 5 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
libosmovty
Target version:
-
Start date:
09/24/2018
Due date:
% Done:

100%

Spec Reference:

Description

Just noticed while building with clang-4.0:

make[2]: Entering directory `/home/.../osmocom/libosmocore/src/vty'
  CC       buffer.lo
  CC       command.lo
  CC       utils.lo
  CC       vector.lo
  CC       vty.lo
command.c:682:8: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
                        if (!elem->attr & CMD_ATTR_DEPRECATED)
                            ^           ~
command.c:682:8: note: add parentheses after the '!' to evaluate the bitwise operator first
                        if (!elem->attr & CMD_ATTR_DEPRECATED)

This warning appears a few times. I guess (not sure) the condition should look like this:

if (!elem->attr & CMD_ATTR_DEPRECATED) ...
Actions #1

Updated by fixeria over 5 years ago

[...] I guess (not sure) the condition should look like this:

if (!(elem->attr & CMD_ATTR_DEPRECATED)) ...
Actions #2

Updated by neels over 5 years ago

let me add

                    && !(cmd->attr == CMD_ATTR_DEPRECATED
                         || cmd->attr == CMD_ATTR_HIDDEN))

http://git.osmocom.org/libosmocore/tree/src/vty/command.c?id=369015c53545f2f67d8610e5d821ee75289122e5#n2731

So it would be not hidden when it is both "deprecated" and "hidden".

Actions #3

Updated by neels over 5 years ago

  • Status changed from New to In Progress
  • Assignee set to neels
  • Priority changed from Normal to Low
  • % Done changed from 0 to 90

remote: https://gerrit.osmocom.org/#/c/libosmocore/+/11070 vty reference: fix deprecation bit evaluation
remote: https://gerrit.osmocom.org/#/c/libosmocore/+/11071 vty list: fix deprecation/hidden bit logic

Actions #4

Updated by fixeria over 5 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 90 to 100

Merged. No warnings anymore.

Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)