mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
warn on if (a = b)
This commit is contained in:
parent
7423ee389d
commit
f8ed454547
1 changed files with 5 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue