warn on if (a = b)

This commit is contained in:
Bill Currie 2004-01-25 21:45:07 +00:00
parent 7423ee389d
commit f8ed454547

View file

@ -1088,6 +1088,11 @@ convert_bool (expr_t *e, int block)
{
expr_t *b;
if (e->type == ex_expr && (e->e.expr.op == '=' || e->e.expr.op == PAS)
&& !e->paren)
warning (e,
"suggest parentheses around assignment used as truth value");
if (e->type == ex_uexpr && e->e.expr.op == '!') {
e = convert_bool (e->e.expr.e1, 0);
if (e->type == ex_error)