glsl: Emit a warning when the left-hand operand of a comma has no effect
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 11 Apr 2011 17:10:30 +0000 (10:10 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 18 Apr 2011 21:43:48 +0000 (14:43 -0700)
commit3d5cfcfed16c5a79bdf67027afe4ea8058b899cb
treeb2e3b12fe452195f5d74e0fe231c98d120d3a351
parent7ca38f5d973cf93bf19e27f3f24c0896e43b16e6
glsl: Emit a warning when the left-hand operand of a comma has no effect

The expression

    x = y, 5, 3;

will generate

    0:7(9): warning: left-hand operand of comma expression has no effect

The warning is only emitted for the left-hand operands, becuase the
right-most operand is the result of the expression.  This could be
used in an assignment, etc.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp