[PATCH vkd3d 3/5] vkd3d-shader: Implement function-like macro expansion.

Zebediah Figura (she/her) zfigura at codeweavers.com
Thu Jan 14 10:17:59 CST 2021


On 1/14/21 7:08 AM, Matteo Bruni wrote:
> On Tue, Jan 12, 2021 at 11:15 PM Zebediah Figura
> <zfigura at codeweavers.com> wrote:
>>
>> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
>> ---
>>  Makefile.am                              |   1 -
>>  libs/vkd3d-shader/preproc.h              |  35 +++
>>  libs/vkd3d-shader/preproc.l              | 329 ++++++++++++++++++-----
>>  libs/vkd3d-shader/preproc.y              |  46 +++-
>>  libs/vkd3d-shader/vkd3d_shader_private.h |   2 +
>>  tests/hlsl_d3d12.c                       |   2 +-
>>  6 files changed, 338 insertions(+), 77 deletions(-)
>>
>> diff --git a/libs/vkd3d-shader/preproc.h b/libs/vkd3d-shader/preproc.h
>> index 7d6bda2a..0f2d8ba9 100644
>> --- a/libs/vkd3d-shader/preproc.h
>> +++ b/libs/vkd3d-shader/preproc.h
>> @@ -60,6 +60,9 @@ struct preproc_expansion
>>  {
>>      struct preproc_buffer buffer;
>>      const struct preproc_text *text;
>> +    /* Back-pointer to the macro, if this expansion a macro body. This is
>> +     * necessary so that argument tokens can be correctly replaced. */
>> +    struct preproc_macro *macro;
>>  };
> 
> This comment seems to be missing a verb.
> 
> Something that I noticed and isn't specifically related to this patch:
> it looks like sometimes there is a "spurious" whitespace at the start
> of a line in the output, maybe after macro expansion. Just to mention
> it, I don't know if you noticed already or if that's actually supposed
> to happen in the first place.
> 

I tried to be careful to ensure there was enough whitespace to prevent
merging of tokens, but I wasn't really careful to match whitespace
closely with native (though the approach of emitting whitespace after
every token seems indeed to match pretty closely). I think native may
emit spurious whitespace on an empty line in some cases.



More information about the wine-devel mailing list