From 12d583b21a7e538d7fa44c3129e95b407d03c01a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 26 Jun 2014 10:56:41 -0700 Subject: glsl/glcpp: Add test for a multi-line comment within an #if 0 block This test is written to exercise a bug which I recently wrote, (but fortunately caught and fixed before ever committing it). For the curious: The bug happened when the NEWLINE_CATCHUP code didn't actually return the NEWLINE token (due to the skipping). This resulted in the lexer continuing on through all the subsequent rules while still in the NEWLINE_CATCHUP start condition, (which then triggered the internal-compiler-error catch-all rule). What is intended is for the return of the NEWLINE token to start a new iteration of the lexer loop, at which time the NEWLINE_CATCHUP-handling code will reset from the to the start condition. Reviewed-by: Jordan Justen --- src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c | 7 +++++++ src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c create mode 100644 src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected (limited to 'src') diff --git a/src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c b/src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c new file mode 100644 index 00000000000..38967dc57d1 --- /dev/null +++ b/src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c @@ -0,0 +1,7 @@ +#if 0 +/* + * This multi-line comment needs to be 3 lines to test what's intended. + */ +#else +SUCCESS +#endif diff --git a/src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected b/src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected new file mode 100644 index 00000000000..0d6ef4d9ad4 --- /dev/null +++ b/src/glsl/glcpp/tests/138-multi-line-comment-in-if-0.c.expected @@ -0,0 +1,7 @@ + + + + + +SUCCESS + -- cgit v1.2.3