Skip to content

Commit 8876f18

Browse files
authored
marzer.tomlplusplus: no SSE2 path under the MSVC ABI (revision 2) (#575)
* 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.
1 parent 203c41b commit 8876f18

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

‎pkgs/m/marzer.tomlplusplus.lua‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ package = {
5353
},
5454
sha256 = "8517f65938a4faae9ccf8ebb36631a38c1cadfb5efa85d9a72e15b9e97d25155",
5555
-- 1: Form B -> Form A (install() writes mcpp.toml + the module unit).
56-
revision = 1,
56+
-- 2: under the MSVC ABI the module unit builds toml++ without its SSE2 path.
57+
revision = 2,
5758
},
5859
},
5960
macosx = {
@@ -64,7 +65,8 @@ package = {
6465
},
6566
sha256 = "8517f65938a4faae9ccf8ebb36631a38c1cadfb5efa85d9a72e15b9e97d25155",
6667
-- 1: Form B -> Form A (install() writes mcpp.toml + the module unit).
67-
revision = 1,
68+
-- 2: under the MSVC ABI the module unit builds toml++ without its SSE2 path.
69+
revision = 2,
6870
},
6971
},
7072
windows = {
@@ -75,7 +77,8 @@ package = {
7577
},
7678
sha256 = "8517f65938a4faae9ccf8ebb36631a38c1cadfb5efa85d9a72e15b9e97d25155",
7779
-- 1: Form B -> Form A (install() writes mcpp.toml + the module unit).
78-
revision = 1,
80+
-- 2: under the MSVC ABI the module unit builds toml++ without its SSE2 path.
81+
revision = 2,
7982
},
8083
},
8184
},
@@ -122,6 +125,16 @@ local MODULE_UNIT = [==[
122125
module;
123126
124127
#define TOML_UNDEF_MACROS 0
128+
// Under the MSVC ABI (cl, or clang in MSVC mode: both define _MSC_VER),
129+
// no SSE2 path: <emmintrin.h> defines its intrinsics `static inline`, and
130+
// clang gives such a function the same mangled name in every module whose
131+
// global module fragment includes it — a unit importing both `std` (MSVC's
132+
// library includes the intrinsics) and `tomlplusplus` then fails with
133+
// "definition with same mangled name". Elsewhere SSE2 stays on. toml++ uses
134+
// it only to skip ASCII faster; the scalar path parses the same documents.
135+
#if defined(_MSC_VER)
136+
#define TOML_ENABLE_SIMD 0
137+
#endif
125138
// mcpp#797: a host-module compile is not given this package's include_dirs,
126139
// so reach the header relative to this file (src/modules/ -> include/).
127140
// Same file either way; restore `<toml++/toml.hpp>` once mcpp#797 is settled.

0 commit comments

Comments
 (0)