mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-21 07:30:53 +00:00
warn when mixing different bitops without parenthesis around them
This commit is contained in:
parent
51ef277e21
commit
f140c39063
1 changed files with 9 additions and 0 deletions
9
parser.c
9
parser.c
|
@ -1714,6 +1714,15 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
|
|||
}
|
||||
}
|
||||
|
||||
if (olast &&
|
||||
olast->id != op->id &&
|
||||
(op->id == opid1('&') || op->id == opid1('|') || op->id == opid1('^')) &&
|
||||
(olast->id == opid1('&') || olast->id == opid1('|') || olast->id == opid1('^')))
|
||||
{
|
||||
(void)!parsewarning(parser, WARN_PARENTHESIS, "suggesting parenthesis around bitwise operations");
|
||||
warn_truthvalue = false;
|
||||
}
|
||||
|
||||
while (olast && (
|
||||
(op->prec < olast->prec) ||
|
||||
(op->assoc == ASSOC_LEFT && op->prec <= olast->prec) ) )
|
||||
|
|
Loading…
Reference in a new issue