glcpp: Fix support for nested #ifdef and nested #ifndef
authorCarl Worth <cworth@cworth.org>
Tue, 20 Jul 2010 21:13:32 +0000 (14:13 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 21 Jul 2010 00:01:11 +0000 (17:01 -0700)
commit1d7e03e48e87328ce0081021dde133921b78b406
tree6bd7be0087307fe520cd2ab672b73e48a65f145c
parent17f9beb6c313b41ca08984add7b76ecb84a7339e
glcpp: Fix support for nested #ifdef and nested #ifndef

Previously, if the outer #ifdef/#ifndef evaluated to false, the inner
directive would not be parsed correctly, (the identifier as the subject
of the #ifdef/#ifndef would inadvertently be skipped along with the other
content correctly being skipped).

We fix this by setting the lexing_if state in each case here.

We also add a new test to the test suite to ensure that this case is tested.
src/glsl/glcpp/glcpp-lex.l
src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c [new file with mode: 0644]
src/glsl/glcpp/tests/067-nested-ifdef-ifndef.c.expected [new file with mode: 0644]