[PATCH vkd3d 7/8] vkd3d-shader/preproc: Don't add additional spaces after whitespace tokens.
Matteo Bruni
mbruni at codeweavers.com
Wed Mar 30 16:38:32 CDT 2022
This is especially a problem when e.g. it introduces a whitespace
before a #pragma directive, breaking shader compilation.
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
libs/vkd3d-shader/preproc.l | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/preproc.l b/libs/vkd3d-shader/preproc.l
index 20cb0c35..7686e018 100644
--- a/libs/vkd3d-shader/preproc.l
+++ b/libs/vkd3d-shader/preproc.l
@@ -578,7 +578,10 @@ int yylex(YYSTYPE *lval, YYLTYPE *lloc, yyscan_t scanner)
if (ctx->current_directive)
return return_token(token, lval, text);
- vkd3d_string_buffer_printf(&ctx->buffer, "%s ", text);
+ if (isspace(text[0]))
+ vkd3d_string_buffer_printf(&ctx->buffer, "%s", text);
+ else
+ vkd3d_string_buffer_printf(&ctx->buffer, "%s ", text);
break;
}
--
2.34.1
More information about the wine-devel
mailing list