[PATCH 1/9] amstream/tests: Use nameless unions.

Jacek Caban jacek at codeweavers.com
Tue Mar 23 09:23:33 CDT 2021


On 3/23/21 12:06 PM, Henri Verbeet wrote:
> On Tue, 23 Mar 2021 at 00:30, Jacek Caban <jacek at codeweavers.com> wrote:
>>
>> Signed-off-by: Jacek Caban <jacek at codeweavers.com>
>> ---
>>    dlls/amstream/tests/Makefile.in | 1 -
>>    dlls/amstream/tests/amstream.c  | 2 +-
>>    2 files changed, 1 insertion(+), 2 deletions(-)
>>
> I don't particularly care about what amstream does, but more broadly,
> I have to say I think nameless unions are somewhat of a misfeature,
> mostly just obfuscating things, not unlike overzealous typedefs.

Sure, but that's not really what those patches are about. They are a 
follow-up for sake of a consistency after b39b9eea39b19a8f, which was 
motivated by compatibility problems fixed by ee587da9e5b1276. They are 
not about liking nameless unions or not.

Let me explain: Microsoft uses quite a lot of nameless unions in Windows 
API. It also provides a standardized way to opt-out of using them with 
NONAMELESSUNIONS macro. That covers majority of use cases and it is not 
affected by this series. There are, however, cases where it's not used 
by Microsoft and we have a mechanism for Wine to opt-out of them anyway. 
This is not compatible with the rest of the world, so it can easily 
cause problems like bug 50836. It's disabled by default now, except for 
modules that opt-in to it. This makes the situation inconsistent inside 
Wine, which is what this series addresses.

That said, if there is a reason to keep using it for some modules, it's 
still there. I would suggest to move it out of makefile and treat it 
like we do with NONAMELESSUNIONS in that case.

Jacek



More information about the wine-devel mailing list