mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-21 19:21:47 +00:00
[qfcc] Back out incorrect precedence check changes
The precedence check changes done in
63795e790b
seem to have been incorrect
(game-source/ctf produced many false positives), so putting that check
against '=' back into the code seems like a good idea (no more false
positives). That sounds a bit cargo-cult, but I'm really not sure what I
was thinking when I did the changes (probably just tired).
This commit is contained in:
parent
a2b5ebde65
commit
67eb38173b
1 changed files with 5 additions and 3 deletions
|
@ -950,7 +950,7 @@ check_precedence (int op, expr_t *e1, expr_t *e2)
|
||||||
{
|
{
|
||||||
if (e1->type == ex_uexpr && e1->e.expr.op == '!' && !e1->paren) {
|
if (e1->type == ex_uexpr && e1->e.expr.op == '!' && !e1->paren) {
|
||||||
if (options.traditional) {
|
if (options.traditional) {
|
||||||
if (op != AND && op != OR) {
|
if (op != AND && op != OR && op != '=') {
|
||||||
notice (e1, "precedence of `!' and `%s' inverted for "
|
notice (e1, "precedence of `!' and `%s' inverted for "
|
||||||
"traditional code", get_op_string (op));
|
"traditional code", get_op_string (op));
|
||||||
e1->e.expr.e1->paren = 1;
|
e1->e.expr.e1->paren = 1;
|
||||||
|
@ -967,7 +967,8 @@ check_precedence (int op, expr_t *e1, expr_t *e2)
|
||||||
if (e2->type == ex_expr && !e2->paren) {
|
if (e2->type == ex_expr && !e2->paren) {
|
||||||
if (((op == '&' || op == '|')
|
if (((op == '&' || op == '|')
|
||||||
&& (is_math_op (e2->e.expr.op) || is_compare (e2->e.expr.op)))
|
&& (is_math_op (e2->e.expr.op) || is_compare (e2->e.expr.op)))
|
||||||
|| (e2->e.expr.op == OR || e2->e.expr.op == AND)) {
|
|| (op == '='
|
||||||
|
&&(e2->e.expr.op == OR || e2->e.expr.op == AND))) {
|
||||||
notice (e1, "precedence of `%s' and `%s' inverted for "
|
notice (e1, "precedence of `%s' and `%s' inverted for "
|
||||||
"traditional code", get_op_string (op),
|
"traditional code", get_op_string (op),
|
||||||
get_op_string (e2->e.expr.op));
|
get_op_string (e2->e.expr.op));
|
||||||
|
@ -988,7 +989,8 @@ check_precedence (int op, expr_t *e1, expr_t *e2)
|
||||||
} else if (e1->type == ex_expr && !e1->paren) {
|
} else if (e1->type == ex_expr && !e1->paren) {
|
||||||
if (((op == '&' || op == '|')
|
if (((op == '&' || op == '|')
|
||||||
&& (is_math_op (e1->e.expr.op) || is_compare (e1->e.expr.op)))
|
&& (is_math_op (e1->e.expr.op) || is_compare (e1->e.expr.op)))
|
||||||
|| (e1->e.expr.op == OR || e1->e.expr.op == AND)) {
|
|| (op == '='
|
||||||
|
&&(e2->e.expr.op == OR || e2->e.expr.op == AND))) {
|
||||||
notice (e1, "precedence of `%s' and `%s' inverted for "
|
notice (e1, "precedence of `%s' and `%s' inverted for "
|
||||||
"traditional code", get_op_string (op),
|
"traditional code", get_op_string (op),
|
||||||
get_op_string (e1->e.expr.op));
|
get_op_string (e1->e.expr.op));
|
||||||
|
|
Loading…
Reference in a new issue