The GLSL specification explicitly allows for an in integer expression here,
not just a literal integer. The specification says:

        #line must have, after macro substitution, one of the following forms:

                #line line
                #line line source-string-number

        where line and source-string-number are constant integer expressions.

Previously, the implementation required a literal integer (after substitution)
so things like "#line (25)" or "#line +15" were allowed by the specification
but rejected by the implementation.

With this change to the grammar, #line will accept integer expressions like
these.

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

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 17bc649..2d9008a 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -221,7 +221,7 @@ expanded_line:
 |      ELIF_EXPANDED expression NEWLINE {
                _glcpp_parser_skip_stack_change_if (parser, & @1, "elif", $2);
        }
-|      LINE_EXPANDED integer_constant NEWLINE {
+|      LINE_EXPANDED expression NEWLINE {
                parser->has_new_line_number = 1;
                parser->new_line_number = $2;
                ralloc_asprintf_rewrite_tail (&parser->output,
@@ -229,7 +229,7 @@ expanded_line:
                                              "#line %" PRIiMAX "\n",
                                              $2);
        }
-|      LINE_EXPANDED integer_constant integer_constant NEWLINE {
+|      LINE_EXPANDED expression integer_constant NEWLINE {
                parser->has_new_line_number = 1;
                parser->new_line_number = $2;
                parser->has_new_source_number = 1;
-- 
1.8.5.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to