Skip to content

Commit

Permalink
Disable std::codecvt<char16_t> and std::codecvt<char32_t> for C++20 a…
Browse files Browse the repository at this point in the history
…nd later.

These specializations were deprecated in C++20, and libc++-19 now generates
deprecation warnings when using std::codecvt<char16_t> and
std::codecvt<char32_t> in C++20 and later modes.
  • Loading branch information
Lastique committed Dec 7, 2024
1 parent 403fff4 commit ddb9868
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions doc/changelog.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

[section:changelog Changelog]

[heading 2.31, Boost 1.88]

* Disabled usage of `std::codecvt<char16_t>` and `std::codecvt<char32_t>` locale facets in C++20 and later modes as they were deprecated in C++20. This means character code conversions to/from `char16_t` and `char32_t` is no longer available in C++20 and later.

[heading 2.30, Boost 1.87]

* Replaced __boost_thread__ synchronization primitives with equivalents from the C++ standard library. This may improve multithreaded performance, but also has user-facing consequences:
Expand Down
8 changes: 5 additions & 3 deletions include/boost/log/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@
# define BOOST_LOG_BROKEN_CONSTANT_EXPRESSIONS
#endif

#if (defined(BOOST_NO_CXX11_HDR_CODECVT) && BOOST_CXX_VERSION < 201703) || (defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142)
#if (defined(BOOST_NO_CXX11_HDR_CODECVT) && BOOST_CXX_VERSION < 201703) || (BOOST_CXX_VERSION >= 202002) || \
(defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142)
// The compiler does not support std::codecvt<char16_t> and std::codecvt<char32_t> specializations.
// The BOOST_NO_CXX11_HDR_CODECVT means there's no usable <codecvt>, which is slightly different from this macro.
// But in order for <codecvt> to be implemented the std::codecvt specializations have to be implemented as well.
// We need to check the C++ version as well, since <codecvt> is deprecated from C++17 onwards which may cause
// BOOST_NO_CXX11_HDR_CODECVT to be set, even though std::codecvt in <locale> is just fine.
// The std::codecvt<char16_t> and std::codecvt<char32_t> specializations were eventually deprecated in C++20.
# define BOOST_LOG_NO_CXX11_CODECVT_FACETS
#endif

Expand All @@ -113,8 +115,8 @@
# include <vsbConfig.h>
#endif

#if (!defined(__CRYSTAX__) && defined(__ANDROID__) && (__ANDROID_API__ < 21)) \
|| (defined(__VXWORKS__) && !defined(_WRS_CONFIG_USER_MANAGEMENT))
#if (!defined(__CRYSTAX__) && defined(__ANDROID__) && (__ANDROID_API__ < 21)) || \
(defined(__VXWORKS__) && !defined(_WRS_CONFIG_USER_MANAGEMENT))
// Until Android API version 21 Google NDK does not provide getpwuid_r
# define BOOST_LOG_NO_GETPWUID_R
#endif
Expand Down

0 comments on commit ddb9868

Please sign in to comment.