[Mesa-dev] [PATCH] glsl: Update the #line behaviour on GLSL 3.30+ and GLSL ES+
Kenneth Graunke
kenneth at whitecape.org
Sun Mar 29 18:29:27 PDT 2015
On Monday, March 23, 2015 09:56:29 AM Antia Puentes wrote:
> From GLSL 3.30 and GLSL ES 1.00 on, after processing the line
> directive (including its new-line), the implementation should
> behave as if it is compiling at the line number passed as
> argument. In previous versions, it behaved as if compiling
> at the passed line number + 1.
>
> Partially fixes https://bugs.freedesktop.org/show_bug.cgi?id=88815
> ---
> src/glsl/glsl_lexer.ll | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
> index f0e047e..2785ed1 100644
> --- a/src/glsl/glsl_lexer.ll
> +++ b/src/glsl/glsl_lexer.ll
> @@ -187,6 +187,15 @@ HASH ^{SPC}#{SPC}
> * one-based.
> */
> yylineno = strtol(ptr, &ptr, 0) - 1;
> +
> + /* From GLSL 3.30 and GLSL ES on, after processing the
> + * line directive (including its new-line), the implementation
> + * will behave as if it is compiling at the line number passed
> + * as argument. It was line number + 1 in older specifications.
> + */
> + if (yyextra->is_version(330, 100))
> + yylineno--;
> +
> yylloc->source = strtol(ptr, NULL, 0);
> }
> {HASH}line{SPCP}{INT}{SPC}$ {
> @@ -202,6 +211,14 @@ HASH ^{SPC}#{SPC}
> * one-based.
> */
> yylineno = strtol(ptr, &ptr, 0) - 1;
> +
> + /* From GLSL 3.30 and GLSL ES on, after processing the
> + * line directive (including its new-line), the implementation
> + * will behave as if it is compiling at the line number passed
> + * as argument. It was line number + 1 in older specifications.
> + */
> + if (yyextra->is_version(330, 100))
> + yylineno--;
> }
> ^{SPC}#{SPC}pragma{SPCP}debug{SPC}\({SPC}on{SPC}\) {
> BEGIN PP;
>
Thanks for taking the time to make our error messages better :)
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150329/9f2a6fa8/attachment.sig>
More information about the mesa-dev
mailing list