glcpp: Reject #version after the version has been resolved.
authorMatt Turner <mattst88@gmail.com>
Wed, 29 Jan 2014 20:48:51 +0000 (12:48 -0800)
committerMatt Turner <mattst88@gmail.com>
Fri, 31 Jan 2014 18:21:50 +0000 (10:21 -0800)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74166
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
src/glsl/glcpp/glcpp-parse.y

index 17bc649ca5a3c102ab12bbc711f0e1904ba95b52..0393ac7c416545ec6d387a2486edd725f8d7292d 100644 (file)
@@ -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 must appear on the first line");
+               }
                _glcpp_parser_handle_version_declaration(parser, $2, NULL, true);
        }
 |      HASH_VERSION integer_constant IDENTIFIER NEWLINE {
+               if (parser->version_resolved) {
+                       glcpp_error(& @1, parser, "#version must appear on the first line");
+               }
                _glcpp_parser_handle_version_declaration(parser, $2, $3, true);
        }
 |      HASH NEWLINE {