Fix clang warnings: Intermediate.cpp: warning: '&&' within '||'

Issue=126 Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch Part 3 of 5: <http://webkit.org/b/56337> Enable -Werror on ANGLE Upstream bug: <http://code.google.com/p/angleproject/issues/detail?id=126> Fixes the following static analyzer warnings: src/compiler/Intermediate.cpp:1008:55:{1008:17-1008:54}: warning: '&&' within '||' [-Wlogical-op-parentheses,2] if (left->isMatrix() && right->isVector() || ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ src/compiler/Intermediate.cpp:1008:55: note: place parentheses around the '&&' expression to silence this warning [2] if (left->isMatrix() && right->isVector() || ^ ( ) fix-it:"src/compiler/Intermediate.cpp":{1008:17-1008:17}:"(" fix-it:"src/compiler/Intermediate.cpp":{1008:54-1008:54}:")" src/compiler/Intermediate.cpp:1008:55:{1009:17-1009:54}: warning: '&&' within '||' [-Wlogical-op-parentheses,2] if (left->isMatrix() && right->isVector() || ^ src/compiler/Intermediate.cpp:1008:55: note: place parentheses around the '&&' expression to silence this warning [2] if (left->isMatrix() && right->isVector() || ^ fix-it:"src/compiler/Intermediate.cpp":{1009:17-1009:17}:"(" fix-it:"src/compiler/Intermediate.cpp":{1009:54-1009:54}:")" src/compiler/Intermediate.cpp:1020:55:{1020:17-1020:54}: warning: '&&' within '||' [-Wlogical-op-parentheses,2] if (left->isMatrix() && right->isVector() || ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ src/compiler/Intermediate.cpp:1020:55: note: place parentheses around the '&&' expression to silence this warning [2] if (left->isMatrix() && right->isVector() || ^ ( ) fix-it:"src/compiler/Intermediate.cpp":{1020:17-1020:17}:"(" fix-it:"src/compiler/Intermediate.cpp":{1020:54-1020:54}:")" src/compiler/Intermediate.cpp:1020:55:{1021:17-1021:54}: warning: '&&' within '||' [-Wlogical-op-parentheses,2] if (left->isMatrix() && right->isVector() || ^ src/compiler/Intermediate.cpp:1020:55: note: place parentheses around the '&&' expression to silence this warning [2] if (left->isMatrix() && right->isVector() || ^ fix-it:"src/compiler/Intermediate.cpp":{1021:17-1021:17}:"(" fix-it:"src/compiler/Intermediate.cpp":{1021:54-1021:54}:")" * src/compiler/Intermediate.cpp: (TIntermBinary::promote): Added parnetheses. Author: David Kilzer <ddkilzer@apple.com> git-svn-id: https://angleproject.googlecode.com/svn/trunk@574 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 0eb64c3a
...@@ -1005,8 +1005,8 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -1005,8 +1005,8 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
case EOpAddAssign: case EOpAddAssign:
case EOpSubAssign: case EOpSubAssign:
case EOpDivAssign: case EOpDivAssign:
if (left->isMatrix() && right->isVector() || if ((left->isMatrix() && right->isVector()) ||
left->isVector() && right->isMatrix()) (left->isVector() && right->isMatrix()))
return false; return false;
setType(TType(basicType, higherPrecision, EvqTemporary, size, left->isMatrix() || right->isMatrix())); setType(TType(basicType, higherPrecision, EvqTemporary, size, left->isMatrix() || right->isMatrix()));
break; break;
...@@ -1017,8 +1017,8 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -1017,8 +1017,8 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
case EOpGreaterThan: case EOpGreaterThan:
case EOpLessThanEqual: case EOpLessThanEqual:
case EOpGreaterThanEqual: case EOpGreaterThanEqual:
if (left->isMatrix() && right->isVector() || if ((left->isMatrix() && right->isVector()) ||
left->isVector() && right->isMatrix()) (left->isVector() && right->isMatrix()))
return false; return false;
setType(TType(EbtBool, EbpUndefined)); setType(TType(EbtBool, EbpUndefined));
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment