From 2da88f4bf70b7cfdf94e348a76a9abdfc4f0157f Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 15 Feb 2023 23:13:06 +1100 Subject: [PATCH] glsl: add _token_list_prepend() helper to the parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will be used in the following patch. Cc: mesa-stable Reviewed-by: Ian Romanick Reviewed-by: Tapani Pälli Part-of: (cherry picked from commit 6e29dce291c45ee0460ddefb34d86b0859f5ce03) --- .pick_status.json | 2 +- src/compiler/glsl/glcpp/glcpp-parse.y | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index 74e1fc1c6d4..1d50bfdd4c6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1039,7 +1039,7 @@ "description": "glsl: add _token_list_prepend() helper to the parser", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y index ab0fd6076c4..9061107ee8a 100644 --- a/src/compiler/glsl/glcpp/glcpp-parse.y +++ b/src/compiler/glsl/glcpp/glcpp-parse.y @@ -99,6 +99,9 @@ _token_create_ival(glcpp_parser_t *parser, int type, int ival); static token_list_t * _token_list_create(glcpp_parser_t *parser); +static void +_token_list_prepend(glcpp_parser_t *parser, token_list_t *list, token_t *token); + static void _token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token); @@ -1088,6 +1091,18 @@ _token_list_create(glcpp_parser_t *parser) return list; } +void +_token_list_prepend(glcpp_parser_t *parser, token_list_t *list, token_t *token) +{ + token_node_t *node; + + node = linear_alloc_child(parser->linalloc, sizeof(token_node_t)); + node->token = token; + node->next = list->head; + + list->head = node; +} + void _token_list_append(glcpp_parser_t *parser, token_list_t *list, token_t *token) {