glsl/glcpp: Add a catch-all rule for unexpected characters

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

In some of the recent glcpp bug-fixing, we found that glcpp was emitting unrecognized characters from the input source file to stdout, and dropping them from the source passed onto the compiler proper.

This was obviously confusing, and totally undesired.

The bogus behavior comes from an implicit default rule in flex, which is that any unmatched character is implicitly matched and printed to stdout.

To avoid this implicit matching and printing, here we add an explicit catch-all rule. If this rule ever matches it prints an internal compiler error. The correct response for any such error is fixing glcpp to handle the unexpected character in the correct way.

f9c99ae glsl/glcpp: Add a catch-all rule for unexpected characters.
src/glsl/glcpp/glcpp-lex.l | 13 +++++++++++++
1 file changed, 13 insertions(+)

Upstream: cgit.freedesktop.org


  • Share