glsl/glcpp: Add testing for EOF sans newline (and fix for <DEFINE>, <COMMENT>)
authorCarl Worth <cworth@cworth.org>
Fri, 20 Jun 2014 21:28:20 +0000 (14:28 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 29 Jul 2014 22:11:48 +0000 (15:11 -0700)
commit5dbdc341e8e8502ab5d98784a24b54c6f3907472
treede3a0c6f1307fb234e030a2cd318949e082fafba
parent21dda50549c5f220eff7ec04a72fb02e5eb09e76
glsl/glcpp: Add testing for EOF sans newline (and fix for <DEFINE>, <COMMENT>)

The glcpp implementation has long had code to support a file that ends without
a final newline. But we didn't have a "make check" test for this.

Additionally, the <EOF> action was restricted only to the <INITIAL> state so
it would fail to get invoked if the EOF was encountered in the <COMMENT> or
the <DEFINE> case. Neither of these was a bug, per se, since EOF in either
of these cases is an error anyway, (either "unterminated comment" or
"missing macro name for #define").

But with the new explicit support for these cases, we not generate clean error
messages in these cases, (rather than "unexpected $end" from before).

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/glsl/glcpp/glcpp-lex.l
src/glsl/glcpp/tests/131-eof-without-newline.c [new file with mode: 0644]
src/glsl/glcpp/tests/131-eof-without-newline.c.expected [new file with mode: 0644]
src/glsl/glcpp/tests/132-eof-without-newline-define.c [new file with mode: 0644]
src/glsl/glcpp/tests/132-eof-without-newline-define.c.expected [new file with mode: 0644]
src/glsl/glcpp/tests/133-eof-without-newline-comment.c [new file with mode: 0644]
src/glsl/glcpp/tests/133-eof-without-newline-comment.c.expected [new file with mode: 0644]