mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
glcpp: Add a test for #elif with an undefined macro.
As written, this test correctly raises an error for #elif being used
with an undefined macro (and not as an argument to "defined"). If the
preceding #if were '#if 1' then this diagnositc would correctly be
hidden. That allows code such as the following to not raise an error:
#ifndef MAYBE_UNDEFINED
#elif MAYBE_UNDEFINED < 5
...
#endif
So this test case is working as expected already. We add it here just
to improve test coverage.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Carl Worth <cworth@cworth.org>
(cherry picked from commit 201485bae0)
This commit is contained in:
parent
c6dfde2136
commit
eb0fd67f6a
2 changed files with 8 additions and 0 deletions
3
src/glsl/glcpp/tests/098-elif-undefined.c
Normal file
3
src/glsl/glcpp/tests/098-elif-undefined.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#if 0
|
||||
#elif UNDEFINED_MACRO
|
||||
#endif
|
||||
5
src/glsl/glcpp/tests/098-elif-undefined.c.expected
Normal file
5
src/glsl/glcpp/tests/098-elif-undefined.c.expected
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
0:2(22): preprocessor error: syntax error, unexpected IDENTIFIER
|
||||
0:1(7): preprocessor error: Unterminated #if
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Reference in a new issue