mstorsjo wrote:

Similarly to the report by @SquallATF above, this also breaks building Wine (in 
mingw mode only, though) - CC @cjacek.

It errors out with errors like these:
```
In file included from ../src/libs/fluidsynth/src/rvoice/fluid_rvoice_dsp.cpp:21:
In file included from ../src/libs/fluidsynth/src/utils/fluid_sys.h:42:
In file included from ../src/libs/fluidsynth/src/utils/fluidsynth_priv.h:34:
In file included from ../src/libs/fluidsynth/glib.h:25:
In file included from ../src/include/winsock.h:108:
In file included from ../src/include/windows.h:68:
In file included from ../src/include/winscard.h:22:
In file included from include/wtypes.h:13:
In file included from ../src/include/ole2.h:25:
In file included from ../src/include/objbase.h:277:
In file included from ../src/include/combaseapi.h:29:
In file included from include/objidlbase.h:415:
include/unknwn.h:80:1: error: 'selectany' can only be applied to variables with 
external linkage
   80 | __CRT_UUID_DECL(IUnknown, 0x00000000, 0x0000, 0x0000, 0xc0,0x00, 
0x00,0x00,0x00,0x00,0x00,0x46)
      | ^
../src/include/guiddef.h:78:9: note: expanded from macro '__CRT_UUID_DECL'
   78 |         __WINE_UUID_ATTR const GUID __wine_uuidof<type>::uuid = 
{l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}; \
      |         ^
../src/include/guiddef.h:48:44: note: expanded from macro '__WINE_UUID_ATTR'
   48 | #   define __WINE_UUID_ATTR __attribute__((selectany))
      |                                            ^
```

The situation can be reproduced with a reduced testcase like this:
```c++
typedef struct _GUID {
    unsigned long Data1;
    unsigned short Data2;
    unsigned short Data3;
    unsigned char Data4[8];
} GUID;
class __wine_uuidof {
    static const GUID uuid;
};  
__attribute__((selectany)) const GUID __wine_uuidof::uuid = 
{0x00000000,0x0000,0x0000,{0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
```

So while the `uuid` class member has the keyword `static`, a `static` C++ class 
member is essentially a global variable - not a variable confined to that 
translation unit - and declaring it as selectany does make sense (and is 
essential).

https://github.com/llvm/llvm-project/pull/189641
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to