Skip to content

Commit d14e002

Browse files
committed
Remove custom microsoft mangling logic. I believe it's no longer needed now that we don't have an iostream ODR violation.
1 parent b396506 commit d14e002

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

libcxx/src/iostream.cpp

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,13 @@ union stream_data {
3333
}
3434
};
3535

36-
#define CHAR_MANGLING_char "D"
37-
#define CHAR_MANGLING_wchar_t "_W"
38-
#define CHAR_MANGLING(CharT) CHAR_MANGLING_##CharT
39-
40-
#ifdef _LIBCPP_COMPILER_CLANG_BASED
41-
# define STRING_DATA_CONSTINIT constinit
42-
#else
43-
# define STRING_DATA_CONSTINIT
44-
#endif
45-
46-
#ifdef _LIBCPP_ABI_MICROSOFT
47-
# define STREAM(StreamT, BufferT, CharT, var) \
48-
STRING_DATA_CONSTINIT stream_data<StreamT<CharT>, BufferT<CharT>> var __asm__( \
49-
"?" #var "@" ABI_NAMESPACE_STR "@std@@3V?$" #StreamT \
50-
"@" CHAR_MANGLING(CharT) "U?$char_traits@" CHAR_MANGLING(CharT) "@" ABI_NAMESPACE_STR "@std@@@12@A")
51-
#else
52-
5336
// To avoid ODR violations without breaking the ABI, we need to define it as a StreamT<CharT>.
5437
// However, since initialization order of statics is arbitrary, we could run DoIOSInit first and then
5538
// construct the stream for a second time, overwriting the data in it.
5639
// To avoid this, we call a constructor overload that specifically avoids initializing any members.
57-
# define STREAM(StreamT, BufferT, CharT, var) \
58-
StreamT<CharT> var{std::__uninitialized_ios_tag{}}; \
59-
stream_data<BufferT<CharT>, StreamT<CharT>, var> sd_##var;
60-
#endif
40+
#define STREAM(StreamT, BufferT, CharT, var) \
41+
StreamT<CharT> var{std::__uninitialized_ios_tag{}}; \
42+
stream_data<BufferT<CharT>, StreamT<CharT>, var> sd_##var;
6143

6244
_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_istream, __stdinbuf, char, cin)
6345
_LIBCPP_EXPORTED_FROM_ABI STREAM(basic_ostream, __stdoutbuf, char, cout)

0 commit comments

Comments
 (0)