diff options
author | Carl Worth <[email protected]> | 2014-06-12 10:39:39 -0700 |
---|---|---|
committer | Carl Worth <[email protected]> | 2014-07-09 12:05:13 -0700 |
commit | 98c0e3c7834f8a99f7641aa14b2bab5221aa66db (patch) | |
tree | 513fa5c5d1dfcfaf7205317b7b0bbfbfe0094631 /src/glsl/glcpp/tests | |
parent | 1d862a0b39dfd2723aac6c64f9a7609c205b3cdc (diff) |
glsl/glcpp: Fix glcpp to catch garbage after #if 1 ... #else
Previously, a line such as:
#else garbage
would flag an error if it followed "#if 0", but not if it followed "#if 1".
We fix this by setting a new bit of state (lexing_else) that allows the lexer
to defer switching to the <SKIP> start state until after the NEWLINE following
the #else directive.
A new test case is added for:
#if 1
#else garbage
#endif
which was untested before, (and did not generate the desired error).
This fixes the following Khronos GLES3 CTS tests:
tokens_after_else_vertex
tokens_after_else_fragment
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/glsl/glcpp/tests')
-rw-r--r-- | src/glsl/glcpp/tests/103-garbage-after-else-0.c (renamed from src/glsl/glcpp/tests/103-garbage-after-else.c) | 0 | ||||
-rw-r--r-- | src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected (renamed from src/glsl/glcpp/tests/103-garbage-after-else.c.expected) | 0 | ||||
-rw-r--r-- | src/glsl/glcpp/tests/123-garbage-after-else-1.c | 3 | ||||
-rw-r--r-- | src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected | 4 |
4 files changed, 7 insertions, 0 deletions
diff --git a/src/glsl/glcpp/tests/103-garbage-after-else.c b/src/glsl/glcpp/tests/103-garbage-after-else-0.c index c460feadf57..c460feadf57 100644 --- a/src/glsl/glcpp/tests/103-garbage-after-else.c +++ b/src/glsl/glcpp/tests/103-garbage-after-else-0.c diff --git a/src/glsl/glcpp/tests/103-garbage-after-else.c.expected b/src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected index f9f5f1976f7..f9f5f1976f7 100644 --- a/src/glsl/glcpp/tests/103-garbage-after-else.c.expected +++ b/src/glsl/glcpp/tests/103-garbage-after-else-0.c.expected diff --git a/src/glsl/glcpp/tests/123-garbage-after-else-1.c b/src/glsl/glcpp/tests/123-garbage-after-else-1.c new file mode 100644 index 00000000000..0b341a381f8 --- /dev/null +++ b/src/glsl/glcpp/tests/123-garbage-after-else-1.c @@ -0,0 +1,3 @@ +#if 1 +#else garbage +#endif diff --git a/src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected b/src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected new file mode 100644 index 00000000000..f9f5f1976f7 --- /dev/null +++ b/src/glsl/glcpp/tests/123-garbage-after-else-1.c.expected @@ -0,0 +1,4 @@ +0:2(7): preprocessor error: syntax error, unexpected IDENTIFIER, expecting NEWLINE +0:1(7): preprocessor error: Unterminated #if + + |