Skip to content

Commit 18cd681

Browse files
committed
Addressed comments.
-define and use macros _LIBCXX_IOS_MAY_USE_OPTIONAL_FILL and _LIBCXX_IOS_FORCE_OPTIONAL_FILL.
1 parent 841c815 commit 18cd681

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

libcxx/include/__configuration/abi.h

+13
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@
9191
# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
9292
// Dont' add an inline namespace for `std::filesystem`
9393
# define _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE
94+
// libcxx std::basic_ios uses WEOF to indicate that the fill value is
95+
// uninitialized. However, on platforms where the size of char_type is
96+
// equal to or greater than the size of int_type,
97+
// std::char_traits<char_type>::eq_int_type() cannot distinguish between WEOF
98+
// and WCHAR_MAX. Helper class _OptionalFill is used for targets where a
99+
// variable is needed to indicate whether the fill value has been initialized.
100+
// Existing targets where this would break ABI compatibility can choose to keep
101+
// the existing ABI by undefining macro _LIBCXX_IOS_MAY_USE_OPTIONAL_FILL.
102+
# define _LIBCXX_IOS_MAY_USE_OPTIONAL_FILL
94103
#elif _LIBCPP_ABI_VERSION == 1
95104
# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
96105
// Enable compiling copies of now inline methods into the dylib to support
@@ -108,6 +117,10 @@
108117
# if defined(__FreeBSD__) && __FreeBSD__ < 14
109118
# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
110119
# endif
120+
// AIX and 64-bit MVS must use _OptionalFill for ABI backward compatibility.
121+
# if defined(_AIX) || (defined(__MVS__) && defined(__64BIT__))
122+
# define _LIBCXX_IOS_FORCE_OPTIONAL_FILL
123+
# endif
111124
#endif
112125

113126
// We had some bugs where we use [[no_unique_address]] together with construct_at,

libcxx/include/ios

+5-10
Original file line numberDiff line numberDiff line change
@@ -617,21 +617,16 @@ protected:
617617
private:
618618
basic_ostream<char_type, traits_type>* __tie_;
619619

620-
#if defined(_AIX) || (defined(__MVS__) && defined(__64BIT__))
621-
// AIX and 64-bit MVS must use _OptionalFill for ABI backward compatibility.
620+
#if defined(_LIBCXX_IOS_FORCE_OPTIONAL_FILL)
622621
using _FillType = _OptionalFill<_Traits>;
623-
#else
624-
#if defined(_WIN32)
625-
static const bool _OptOutForABICompat = true;
626-
#else
627-
static const bool _OptOutForABICompat = false;
628-
#endif
629-
622+
#elif defined(_LIBCXX_IOS_MAY_USE_OPTIONAL_FILL)
630623
using _FillType = _If<
631-
sizeof(char_type) >= sizeof(int_type) && !_OptOutForABICompat,
624+
sizeof(char_type) >= sizeof(int_type),
632625
_OptionalFill<_Traits>,
633626
_SentinelValueFill<_Traits>
634627
>;
628+
#else
629+
using _FillType = _SentinelValueFill<_Traits>;
635630
#endif
636631
mutable _FillType __fill_;
637632
};

0 commit comments

Comments
 (0)