[Mesa-dev] [PATCH 1/2] glcpp: Allow integer expression for #line directive.
Matt Turner
mattst88 at gmail.com
Tue Jan 28 18:11:27 PST 2014
On Tue, Jan 28, 2014 at 5:56 PM, Carl Worth <cworth at cworth.org> wrote:
> 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.
If this is the case, then
>
> 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 {
shouldn't this should be
LINE_EXPANDED expression expression NEWLINE
More information about the mesa-dev
mailing list