Skip to content

marzer.tomlplusplus: no SSE2 path under the MSVC ABI (revision 2) - #575

Merged
Sunrisepeak merged 2 commits into
mainfrom
tomlplusplus-no-simd
Oct 26, 2026
Merged

Sunrisepeak merged 2 commits into
mainfrom
tomlplusplus-no-simd

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

A unit that imports both std and tomlplusplus does not compile with clang under the MSVC ABI (found by openmui's Windows CI, Sunrisepeak/mui#1):

In module 'tomlplusplus' imported from tools/gen/src/read.cpp:4:
lib/clang/23/include/emmintrin.h:4284:1: error: definition with same mangled name '?_mm_movemask_epi8@@YAHT__m128i@@@Z' as another definition

<emmintrin.h> defines its intrinsics static inline; under the MSVC ABI clang gives such a function the same mangled name in every module whose global module fragment includes the header, and MSVC's library (behind std) includes it too. toml++ includes it only for its SSE2 fast path (impl/simd.hpp), which skips ASCII faster.

The generated module unit now defines TOML_ENABLE_SIMD 0 in its global module fragment, so the module includes no intrinsics header; the scalar path parses the same documents (checked with GCC and clang: parsing works and no emmintrin.h is included). The payload changes, so the revision goes to 2 on every platform.

…ath (revision 2)

<emmintrin.h> defines its intrinsics static inline. Under the MSVC ABI clang
gives such a function the same mangled name in every module whose global
module fragment includes the header, so a unit that imports both std (MSVC's
library includes the intrinsics) and tomlplusplus fails with "definition with
same mangled name '?_mm_movemask_epi8@@...'". toml++ used SSE2 only to skip
ASCII faster; with TOML_ENABLE_SIMD 0 the scalar path parses the same
documents and the module includes no intrinsics header.
The collision is an MSVC-ABI one; Linux, macOS and MinGW keep toml++'s SSE2
path.
@Sunrisepeak Sunrisepeak changed the title marzer.tomlplusplus: build the module without toml++'s SSE2 path (revision 2) marzer.tomlplusplus: no SSE2 path under the MSVC ABI (revision 2) Oct 26, 2026
@Sunrisepeak

Copy link
Copy Markdown
Member Author

Narrowed: TOML_ENABLE_SIMD 0 is now defined only under the MSVC ABI (#if defined(_MSC_VER) — cl, and clang in MSVC mode, define it), where the static-inline intrinsics collide. Linux, macOS and MinGW keep the SSE2 path.

@Sunrisepeak
Sunrisepeak merged commit 8876f18 into main Oct 26, 2026
30 of 32 checks passed
Sunrisepeak added a commit that referenced this pull request Oct 26, 2026
* marzer.tomlplusplus: the module unit builds toml++ without its SSE2 path (revision 2)

<emmintrin.h> defines its intrinsics static inline. Under the MSVC ABI clang
gives such a function the same mangled name in every module whose global
module fragment includes the header, so a unit that imports both std (MSVC's
library includes the intrinsics) and tomlplusplus fails with "definition with
same mangled name '?_mm_movemask_epi8@@...'". toml++ used SSE2 only to skip
ASCII faster; with TOML_ENABLE_SIMD 0 the scalar path parses the same
documents and the module includes no intrinsics header.

* marzer.tomlplusplus: turn SSE2 off under the MSVC ABI only (_MSC_VER)

The collision is an MSVC-ABI one; Linux, macOS and MinGW keep toml++'s SSE2
path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant