[PATCH vkd3d] vkd3d-shader: Get rid of spurious '\n' in HLSL compiler messages.

Matteo Bruni mbruni at codeweavers.com
Tue Feb 9 10:38:04 CST 2021


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
Feel free to shoot down this patch if it's in the way.

 libs/vkd3d-shader/hlsl.y | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 8fc7f82..a498d14 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -739,7 +739,7 @@ static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *ty
         field->semantic = v->semantic;
         if (v->initializer.args_count)
         {
-            hlsl_report_message(ctx, v->loc, HLSL_LEVEL_ERROR, "struct field with an initializer.\n");
+            hlsl_report_message(ctx, v->loc, HLSL_LEVEL_ERROR, "struct field with an initializer");
             free_parse_initializer(&v->initializer);
         }
         list_add_tail(list, &field->entry);
@@ -1912,7 +1912,7 @@ func_prototype:
             }
             if (hlsl_get_var(ctx->globals, $3))
             {
-                hlsl_report_message(ctx, @3, HLSL_LEVEL_ERROR, "redefinition of '%s'\n", $3);
+                hlsl_report_message(ctx, @3, HLSL_LEVEL_ERROR, "redefinition of '%s'", $3);
                 YYABORT;
             }
             if (hlsl_type_is_void($2) && $7.semantic)
@@ -2082,13 +2082,13 @@ type:
             if ($3->type != HLSL_CLASS_SCALAR)
             {
                 hlsl_report_message(ctx, @3, HLSL_LEVEL_ERROR,
-                        "vectors of non-scalar types are not allowed\n");
+                        "vectors of non-scalar types are not allowed");
                 YYABORT;
             }
             if ($5 < 1 || $5 > 4)
             {
                 hlsl_report_message(ctx, @5, HLSL_LEVEL_ERROR,
-                        "vector size must be between 1 and 4\n");
+                        "vector size must be between 1 and 4");
                 YYABORT;
             }
 
@@ -2099,19 +2099,19 @@ type:
             if ($3->type != HLSL_CLASS_SCALAR)
             {
                 hlsl_report_message(ctx, @3, HLSL_LEVEL_ERROR,
-                        "matrices of non-scalar types are not allowed\n");
+                        "matrices of non-scalar types are not allowed");
                 YYABORT;
             }
             if ($5 < 1 || $5 > 4)
             {
                 hlsl_report_message(ctx, @5, HLSL_LEVEL_ERROR,
-                        "matrix row count must be between 1 and 4\n");
+                        "matrix row count must be between 1 and 4");
                 YYABORT;
             }
             if ($7 < 1 || $7 > 4)
             {
                 hlsl_report_message(ctx, @7, HLSL_LEVEL_ERROR,
-                        "matrix column count must be between 1 and 4\n");
+                        "matrix column count must be between 1 and 4");
                 YYABORT;
             }
 
@@ -2152,7 +2152,7 @@ base_type:
         {
             $$ = hlsl_get_type(ctx->cur_scope, $2, true);
             if ($$->type != HLSL_CLASS_STRUCT)
-                hlsl_report_message(ctx, @1, HLSL_LEVEL_ERROR, "'%s' redefined as a structure\n", $2);
+                hlsl_report_message(ctx, @1, HLSL_LEVEL_ERROR, "'%s' redefined as a structure", $2);
             vkd3d_free($2);
         }
 
@@ -2275,7 +2275,7 @@ array:
             if (!size)
             {
                 hlsl_report_message(ctx, @2, HLSL_LEVEL_ERROR,
-                        "array size is not a positive integer constant\n");
+                        "array size is not a positive integer constant");
                 YYABORT;
             }
             TRACE("Array size %u.\n", size);
@@ -2528,7 +2528,7 @@ primary_expr:
 
             if (!(var = hlsl_get_var(ctx->cur_scope, $1)))
             {
-                hlsl_report_message(ctx, @1, HLSL_LEVEL_ERROR, "variable '%s' is not declared\n", $1);
+                hlsl_report_message(ctx, @1, HLSL_LEVEL_ERROR, "variable '%s' is not declared", $1);
                 YYABORT;
             }
             if ((load = hlsl_new_var_load(var, @1)))
@@ -2654,19 +2654,19 @@ postfix_expr:
             if ($1)
             {
                 hlsl_report_message(ctx, @1, HLSL_LEVEL_ERROR,
-                        "unexpected modifier on a constructor\n");
+                        "unexpected modifier on a constructor");
                 YYABORT;
             }
             if ($2->type > HLSL_CLASS_LAST_NUMERIC)
             {
                 hlsl_report_message(ctx, @2, HLSL_LEVEL_ERROR,
-                        "constructors may only be used with numeric data types\n");
+                        "constructors may only be used with numeric data types");
                 YYABORT;
             }
             if ($2->dimx * $2->dimy != initializer_size(&$4))
             {
                 hlsl_report_message(ctx, @4, HLSL_LEVEL_ERROR,
-                        "expected %u components in constructor, but got %u\n",
+                        "expected %u components in constructor, but got %u",
                         $2->dimx * $2->dimy, initializer_size(&$4));
                 YYABORT;
             }
-- 
2.26.2




More information about the wine-devel mailing list