Skip to content

Commit

Permalink
Addressed comments.
Browse files Browse the repository at this point in the history
-define and use macros _LIBCXX_IOS_MAY_USE_OPTIONAL_FILL and _LIBCXX_IOS_FORCE_OPTIONAL_FILL.
  • Loading branch information
xingxue-ibm committed Jun 3, 2024
1 parent 841c815 commit 18cd681
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 13 additions & 0 deletions libcxx/include/__configuration/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@
# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
// Dont' add an inline namespace for `std::filesystem`
# define _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE
// libcxx std::basic_ios uses WEOF to indicate that the fill value is
// uninitialized. However, on platforms where the size of char_type is
// equal to or greater than the size of int_type,
// std::char_traits<char_type>::eq_int_type() cannot distinguish between WEOF
// and WCHAR_MAX. Helper class _OptionalFill is used for targets where a
// variable is needed to indicate whether the fill value has been initialized.
// Existing targets where this would break ABI compatibility can choose to keep
// the existing ABI by undefining macro _LIBCXX_IOS_MAY_USE_OPTIONAL_FILL.
# define _LIBCXX_IOS_MAY_USE_OPTIONAL_FILL
#elif _LIBCPP_ABI_VERSION == 1
# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
// Enable compiling copies of now inline methods into the dylib to support
Expand All @@ -108,6 +117,10 @@
# if defined(__FreeBSD__) && __FreeBSD__ < 14
# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
# endif
// AIX and 64-bit MVS must use _OptionalFill for ABI backward compatibility.
# if defined(_AIX) || (defined(__MVS__) && defined(__64BIT__))
# define _LIBCXX_IOS_FORCE_OPTIONAL_FILL
# endif
#endif

// We had some bugs where we use [[no_unique_address]] together with construct_at,
Expand Down
15 changes: 5 additions & 10 deletions libcxx/include/ios
Original file line number Diff line number Diff line change
Expand Up @@ -617,21 +617,16 @@ protected:
private:
basic_ostream<char_type, traits_type>* __tie_;

#if defined(_AIX) || (defined(__MVS__) && defined(__64BIT__))
// AIX and 64-bit MVS must use _OptionalFill for ABI backward compatibility.
#if defined(_LIBCXX_IOS_FORCE_OPTIONAL_FILL)
using _FillType = _OptionalFill<_Traits>;
#else
#if defined(_WIN32)
static const bool _OptOutForABICompat = true;
#else
static const bool _OptOutForABICompat = false;
#endif

#elif defined(_LIBCXX_IOS_MAY_USE_OPTIONAL_FILL)
using _FillType = _If<
sizeof(char_type) >= sizeof(int_type) && !_OptOutForABICompat,
sizeof(char_type) >= sizeof(int_type),
_OptionalFill<_Traits>,
_SentinelValueFill<_Traits>
>;
#else
using _FillType = _SentinelValueFill<_Traits>;
#endif
mutable _FillType __fill_;
};
Expand Down

0 comments on commit 18cd681

Please sign in to comment.