You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Automerge: Allow weak/selectany external definitions in header units. (#162713)
weak and selectany are mechanisms for allowing the linker to resolve ODR
violations. [module.import/6] states
> A header unit shall not contain a definition of a non-inline function
or variable whose name has external linkage.
But this prevents compiling any headers with such weak symbols defined.
These occur in eg. some Windows SDK headers like `DirectXMath.h`.
```
#ifndef XMGLOBALCONST
#if defined(__GNUC__) && !defined(__MINGW32__)
#define XMGLOBALCONST extern const __attribute__((weak))
#else
#define XMGLOBALCONST extern const __declspec(selectany)
#endif
#endif
XMGLOBALCONST XMVECTORF32 g_XMSinCoefficients0 = { { { -0.16666667f, +0.0083333310f, -0.00019840874f, +2.7525562e-06f } } };
```
Proposed solution: Do not emit `diag::err_extern_def_in_header_unit` if
the `FD` or `VDecl` have either `SelectAnyAttr` or `WeakAttr`.
0 commit comments