[PATCH 5/5] widl: Generate helper macros for WinRT implementation.

Jacek Caban jacek at codeweavers.com
Thu Feb 25 07:47:51 CST 2021


On 19.02.2021 20:43, Rémi Bernon wrote:
> On 2/19/21 8:12 PM, Jacek Caban wrote:
>> On 19.02.2021 18:18, Rémi Bernon wrote:
>>> Hi Jacek!
>>>
>>> On 2/19/21 5:48 PM, Jacek Caban wrote:
>>>> Hi Rémi,
>>>>
>>>>
>>>> On 19.02.2021 12:04, Rémi Bernon wrote:
>>>>> This generates additional macros to help keeping implementation 
>>>>> simple,
>>>>> guarded with WIDL_USING ifdefs, like this:
>>>>>
>>>>>      #ifdef WIDL_USING_WINDOWS_FOO_IFOO
>>>>
>>>>
>>>> I would find it more readable if we didn't follow all-uppercase for 
>>>> macro rule here, something like:
>>>>
>>>> #define WIDL_using_Windows_Foo_IFoo
>>>>
>>>> But it's a matter of taste, so I'm mentioning it just for 
>>>> consideration.
>>>>
>>>
>>> Yeah I don't really like it much, but I can see one reason to make 
>>> something like that, which would also possibly solve the [1] below:
>>>
>>> For making things simpler to type, it could just be the type C name 
>>> prefixed by WIDL_USING_, like in:
>>>
>>> #define WIDL_USING_CWindows_CGaming_CInput_CIRawGameController
>>>
>>> The generation of the guard macros would just have to remove the 
>>> __x_ABI_ prefix, and developers just need to copy paste the type 
>>> names they want without having to remove the C prefixes or mess with 
>>> the name case.
>>
>>
>> I hope that we can save developers from dealing with details about 
>> name mangling, at least in non-templated cases. Ideally they would be 
>> able to type it manually.
>>
>
> Well, in that case all upper case could also save some effort trying 
> to guess how the words are supposed to be capitalized :) 


The other way to look at this is that now you have to take the original 
spelling and do an additional step to upper case it :) My original 
comment also applied to the other part of the patch, which required 
developer to know when and how to use _F instead of _C. It may be less 
of a deal for namespaces, but if we ever want to apply it to per-type as 
well, I find IRAWGAMECONTROLLER much less readable than IRawGameController.


widl already generates a number of macros that include type names in 
their original casing. Upper casing only selected extension macros feels 
inconsistent to me.


Thanks,

Jacek




More information about the wine-devel mailing list