2 * sparse/check_precedence.c
4 * Copyright (C) 20XX Your Name.
6 * Licensed under the Open Software License version 1.1
14 static void match_condition(struct expression
*expr
)
16 if (expr
->type
!= EXPR_BINOP
)
18 if (expr
->left
->type
== EXPR_COMPARE
||
19 expr
->right
->type
== EXPR_COMPARE
)
20 sm_msg("warning: do you want parens here?");
23 static void match_binop(struct expression
*expr
)
27 if (expr
->left
->op
== '!')
28 sm_msg("warning: you probably want parens here.");
32 void check_precedence(int id
)
36 add_hook(&match_condition
, CONDITION_HOOK
);
37 add_hook(&match_binop
, BINOP_HOOK
);