From: Wolfgang Bumiller Date: Thu, 29 Aug 2013 06:18:06 +0000 (+0200) Subject: warn when mixing different bitops without parenthesis around them X-Git-Tag: 0.3.5~118^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f140c3906353577bcf3fe584cf9ee5beff639132;p=xonotic%2Fgmqcc.git warn when mixing different bitops without parenthesis around them --- diff --git a/parser.c b/parser.c index 2277abf..92301d4 100644 --- a/parser.c +++ b/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) ) )