Zebediah Figura : vkd3d-shader: Implement addition and subtraction in #if directives.

Alexandre Julliard julliard at winehq.org
Thu Jan 21 16:06:45 CST 2021


Module: vkd3d
Branch: master
Commit: 76383b244bdff2ad99f55235fd50c073835f707d
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=76383b244bdff2ad99f55235fd50c073835f707d

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Jan 19 11:18:20 2021 -0600

vkd3d-shader: Implement addition and subtraction in #if directives.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/preproc.y | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/libs/vkd3d-shader/preproc.y b/libs/vkd3d-shader/preproc.y
index eb2036c..61b6baf 100644
--- a/libs/vkd3d-shader/preproc.y
+++ b/libs/vkd3d-shader/preproc.y
@@ -336,6 +336,7 @@ static void free_parse_arg_names(struct parse_arg_names *args)
 %type <integer> primary_expr
 %type <integer> unary_expr
 %type <integer> mul_expr
+%type <integer> add_expr
 %type <string> body_token
 %type <const_string> body_token_const
 %type <string_buffer> body_text
@@ -489,7 +490,7 @@ directive
             }
             vkd3d_free($2);
         }
-    | T_IF mul_expr T_NEWLINE
+    | T_IF add_expr T_NEWLINE
         {
             if (!preproc_push_if(ctx, !!$2))
                 YYABORT;
@@ -504,7 +505,7 @@ directive
             preproc_push_if(ctx, !preproc_find_macro(ctx, $2));
             vkd3d_free($2);
         }
-    | T_ELIF mul_expr T_NEWLINE
+    | T_ELIF add_expr T_NEWLINE
         {
             const struct preproc_file *file = preproc_get_top_file(ctx);
 
@@ -656,3 +657,14 @@ mul_expr
             }
             $$ = $1 / $3;
         }
+
+add_expr
+    : mul_expr
+    | add_expr '+' mul_expr
+        {
+            $$ = $1 + $3;
+        }
+    | add_expr '-' mul_expr
+        {
+            $$ = $1 - $3;
+        }




More information about the wine-cvs mailing list