Mesa (master): glsl/glcpp: Promote "extra token at end of directive" from warning to error
Carl Worth
cworth at kemper.freedesktop.org
Wed Jul 9 19:05:35 UTC 2014
Module: Mesa
Branch: master
Commit: 43047384c331a9240339563704fe5d97ebe599d7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=43047384c331a9240339563704fe5d97ebe599d7
Author: Carl Worth <cworth at cworth.org>
Date: Fri Jun 13 15:40:42 2014 -0700
glsl/glcpp: Promote "extra token at end of directive" from warning to error
We've always warned about this case, but a recent confromance test expects
this to be an error that causes compilation to fail. Make it so.
Also add a "make check" test to ensure these errors are generated.
This fixes the following Khronos GLES3 conformance tests:
invalid_conditionals.tokens_after_ifdef_vertex
invalid_conditionals.tokens_after_ifdef_fragment
invalid_conditionals.tokens_after_ifndef_vertex
invalid_conditionals.tokens_after_ifndef_fragment
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/glsl/glcpp/glcpp-parse.y | 2 +-
src/glsl/glcpp/tests/126-garbage-after-directive.c | 5 +++++
src/glsl/glcpp/tests/126-garbage-after-directive.c.expected | 8 ++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 2679401..21c85b4 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -625,7 +625,7 @@ replacement_list:
junk:
/* empty */
| pp_tokens {
- glcpp_warning(&@1, parser, "extra tokens at end of directive");
+ glcpp_error(&@1, parser, "extra tokens at end of directive");
}
;
diff --git a/src/glsl/glcpp/tests/126-garbage-after-directive.c b/src/glsl/glcpp/tests/126-garbage-after-directive.c
new file mode 100644
index 0000000..4c0d290
--- /dev/null
+++ b/src/glsl/glcpp/tests/126-garbage-after-directive.c
@@ -0,0 +1,5 @@
+#ifdef MACRO garbage
+#endif
+
+#ifndef MORE garbage
+#endif
diff --git a/src/glsl/glcpp/tests/126-garbage-after-directive.c.expected b/src/glsl/glcpp/tests/126-garbage-after-directive.c.expected
new file mode 100644
index 0000000..95a9e61
--- /dev/null
+++ b/src/glsl/glcpp/tests/126-garbage-after-directive.c.expected
@@ -0,0 +1,8 @@
+0:1(15): preprocessor error: extra tokens at end of directive
+0:4(14): preprocessor error: extra tokens at end of directive
+
+
+
+
+
+
More information about the mesa-commit
mailing list