From d5ff432d7d08c8bb644594ccf28b83be4b521ffe Mon Sep 17 00:00:00 2001 From: Sviatoslav Peleshko Date: Mon, 3 Jul 2023 09:45:29 +0300 Subject: [PATCH] glsl: Fix yylloc.source propagation in YYLLOC_DEFAULT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, it's always initialized to 0, but we should take the value from the grouping passed to the macro. This way parser will have the full location info, and errors originating from it will show the correct source file number. Fixes: a0cfe8c4 ("glsl: Fix missing initialization of yylloc.source") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9229 Signed-off-by: Sviatoslav Peleshko Reviewed-by: Marek Olšák Part-of: (cherry picked from commit 791785c2b4c01abf1a0207fb4697789ff03af218) --- .pick_status.json | 2 +- src/compiler/glsl/glcpp/glcpp.h | 3 ++- src/compiler/glsl/glsl_parser_extras.h | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 89eeb1f0e95..cb1385cb9ca 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3757,7 +3757,7 @@ "description": "glsl: Fix yylloc.source propagation in YYLLOC_DEFAULT", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "a0cfe8c44085032fd982bbbff1f02252ffaa7114" }, diff --git a/src/compiler/glsl/glcpp/glcpp.h b/src/compiler/glsl/glcpp/glcpp.h index b797433adb1..d1d22274f29 100644 --- a/src/compiler/glsl/glcpp/glcpp.h +++ b/src/compiler/glsl/glcpp/glcpp.h @@ -91,6 +91,7 @@ do { \ (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ + (Current).source = YYRHSLOC(Rhs, N).source; \ } \ else \ { \ @@ -98,8 +99,8 @@ do { \ YYRHSLOC(Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC(Rhs, 0).last_column; \ + (Current).source = YYRHSLOC(Rhs, 0).source; \ } \ - (Current).source = 0; \ } while (0) struct token { diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index a8fb7a5572c..fc6e4877824 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -998,6 +998,7 @@ do { \ (Current).last_line = YYRHSLOC(Rhs, N).last_line; \ (Current).last_column = YYRHSLOC(Rhs, N).last_column; \ (Current).path = YYRHSLOC(Rhs, N).path; \ + (Current).source = YYRHSLOC(Rhs, N).source; \ } \ else \ { \ @@ -1005,9 +1006,9 @@ do { \ YYRHSLOC(Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC(Rhs, 0).last_column; \ - (Current).path = YYRHSLOC(Rhs, 0).path; \ + (Current).path = YYRHSLOC(Rhs, 0).path; \ + (Current).source = YYRHSLOC(Rhs, 0).source; \ } \ - (Current).source = 0; \ } while (0) /**