glsl/glcpp: Add (non)-support for ++ and -- operators

Graphics / Mesa 3D Graphics Library / Mesa - Carl Worth [cworth.org] - 29 July 2014 17:11 UTC

These operators aren't defined for preprocessor expressions, so we never implemented them. This led them to be misinterpreted as strings of unary '+' or '-' operators.

In fact, what is actually desired is to generate an error if these operators appear in any preprocessor condition.

So this commit looks like it is strictly adding support for these operators. And it is supporting them as far as passing them through to the subsequent compiler, (which was already happening anyway).

What's less apparent in the commit is that with these tokens now being lexed, but with no change to the grammar for preprocessor expressions, these operators will now trigger errors there.

A new "make check" test is added to verify the desired behavior.

This commit fixes the following Khronos GLES3 CTS test:

invalid_op_1_vertex invalid_op_1_fragment invalid_op_2_vertex invalid_op_2_fragment

285c939 glsl/glcpp: Add (non)-support for ++ and -- operators
src/glsl/glcpp/glcpp-lex.l | 8 ++++++++
src/glsl/glcpp/glcpp-parse.y | 10 +++++++++-
.../glcpp/tests/136-plus-plus-and-minus-minus.c | 8 ++++++++
.../tests/136-plus-plus-and-minus-minus.c.expected | 8 ++++++++
4 files changed, 33 insertions(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share