diff --git a/libs/vkd3d-shader/preproc.l b/libs/vkd3d-shader/preproc.l index d360f6ca..be50d3b9 100644 --- a/libs/vkd3d-shader/preproc.l +++ b/libs/vkd3d-shader/preproc.l @@ -65,7 +65,7 @@ static void update_location(struct preproc_ctx *ctx); %s LINE NEWLINE \r?\n -WS [ \t] +WS [ \t\r] IDENTIFIER [A-Za-z_][A-Za-z0-9_]* INT_SUFFIX [uUlL]{0,2} diff --git a/tests/hlsl_d3d12.c b/tests/hlsl_d3d12.c index 8d5d8d90..215d624a 100644 --- a/tests/hlsl_d3d12.c +++ b/tests/hlsl_d3d12.c @@ -379,6 +379,18 @@ static void test_preprocess(void) "pass", "fail", }, + + /* CRs are treated as whitespace. */ + { + "#define\rKEY(a,\rb)\ra##b\r\n" + "KEY(pa,\rss)\r\n" + "#ifndef\rKEY\r\n" + "fail\r\n" + "#endif\r\n", + + "pass", + "fail", + } }; for (i = 0; i < ARRAY_SIZE(tests); ++i)