summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2015-03-17 19:12:23 +0100
committerIago Toral Quiroga <[email protected]>2015-04-06 08:55:10 +0200
commit490621f0f2814ff1713c74f030acaff3f19cf8fb (patch)
tree2244eab930d26afc427b501ad7894f1ce77ccfe0
parentc0a7014601ca93d30ba9bf1ec3c6d04da904d503 (diff)
glsl: Update the #line behaviour on GLSL 3.30+ and GLSL ES+
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 Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/glsl/glsl_lexer.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index f0e047ebd70..2785ed16884 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;