From eb212c5a302f0122a13b36dfdf07e91f951ae2e7 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Tue, 17 Dec 2013 16:37:33 +0100 Subject: glcpp: error on multiple #else/#elif directives The preprocessor currently accepts multiple else/elif-groups per if-section. The GLSL-preprocessor is defined by the C++ specification, which defines the following parse-rule: if-section: if-group elif-groups(opt) else-group(opt) endif-line This clearly only allows a single else-group, that has to come after any elif-groups. So let's modify the code to follow the specification. Add test to prevent regressions. Reviewed-by: Ian Romanick Reviewed-by: Kenneth Graunke Reviewed-by: Carl Worth Cc: 10.0 --- src/glsl/glcpp/tests/119-elif-after-else.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/glsl/glcpp/tests/119-elif-after-else.c (limited to 'src/glsl/glcpp/tests/119-elif-after-else.c') diff --git a/src/glsl/glcpp/tests/119-elif-after-else.c b/src/glsl/glcpp/tests/119-elif-after-else.c new file mode 100644 index 00000000000..9b9e9233bcb --- /dev/null +++ b/src/glsl/glcpp/tests/119-elif-after-else.c @@ -0,0 +1,6 @@ +#if 0 +#else +int foo; +#elif 0 +int bar; +#endif -- cgit v1.2.3