[Mesa-dev] [PATCH] glcpp: Reject #version after the version has been resolved.

Matt Turner mattst88 at gmail.com
Wed Jan 29 12:48:51 PST 2014


Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74166
---
 src/glsl/glcpp/glcpp-parse.y | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 17bc649..4dba051 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -375,9 +375,15 @@ control_line:
 		_glcpp_parser_skip_stack_pop (parser, & @1);
 	} NEWLINE
 |	HASH_VERSION integer_constant NEWLINE {
+		if (parser->version_resolved) {
+			glcpp_error(& @1, parser, "#version after version is resolved");
+		}
 		_glcpp_parser_handle_version_declaration(parser, $2, NULL, true);
 	}
 |	HASH_VERSION integer_constant IDENTIFIER NEWLINE {
+		if (parser->version_resolved) {
+			glcpp_error(& @1, parser, "#version after version is resolved");
+		}
 		_glcpp_parser_handle_version_declaration(parser, $2, $3, true);
 	}
 |	HASH NEWLINE {
-- 
1.8.3.2



More information about the mesa-dev mailing list