2 * sparse/check_logical_instead_of_bitwise.c
4 * Copyright (C) 2012 Oracle.
6 * Licensed under the Open Software License version 1.1
14 static void match_logic(struct expression
*expr
)
18 if (expr
->type
!= EXPR_LOGICAL
)
21 if (get_macro_name(&expr
->pos
))
24 if (!get_value(expr
->right
, &val
)) {
25 if (!get_value(expr
->left
, &val
))
29 if (val
== 0 || val
== 1)
32 sm_msg("warn: should this be a bitwise op?");
35 void check_logical_instead_of_bitwise(int id
)
39 add_hook(&match_logic
, LOGIC_HOOK
);