Skip to content

Conversation

mordante
Copy link
Member

This is addresses a review comment in #73262.

This is addresses a review comment in llvm#73262.
@mordante mordante requested a review from a team as a code owner December 23, 2023 14:49
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 23, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 23, 2023

@llvm/pr-subscribers-libcxx

Author: Mark de Wever (mordante)

Changes

This is addresses a review comment in #73262.


Full diff: https://github.com/llvm/llvm-project/pull/76290.diff

2 Files Affected:

  • (modified) libcxx/include/ostream (+2-2)
  • (modified) libcxx/include/print (+5-5)
diff --git a/libcxx/include/ostream b/libcxx/include/ostream
index 88ee9d93a1d36c..25b3b49262be40 100644
--- a/libcxx/include/ostream
+++ b/libcxx/include/ostream
@@ -1137,7 +1137,7 @@ template <class... _Args>
 _LIBCPP_AVAILABILITY_PRINT _LIBCPP_HIDE_FROM_ABI void
 print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
 #  ifndef _LIBCPP_HAS_NO_UNICODE
-  if constexpr (__print::__use_unicode)
+  if constexpr (__print::__use_unicode_execution_charset)
     std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), false);
   else
     std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), false);
@@ -1153,7 +1153,7 @@ println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) {
   // Note the wording in the Standard is inefficient. The output of
   // std::format is a std::string which is then copied. This solution
   // just appends a newline at the end of the output.
-  if constexpr (__print::__use_unicode)
+  if constexpr (__print::__use_unicode_execution_charset)
     std::__vprint_unicode(__os, __fmt.get(), std::make_format_args(__args...), true);
   else
     std::__vprint_nonunicode(__os, __fmt.get(), std::make_format_args(__args...), true);
diff --git a/libcxx/include/print b/libcxx/include/print
index 0f8e73f8eb5c74..4aee13a8925c11 100644
--- a/libcxx/include/print
+++ b/libcxx/include/print
@@ -188,13 +188,13 @@ namespace __print {
 //
 
 #  ifdef _LIBCPP_HAS_NO_UNICODE
-inline constexpr bool __use_unicode = false;
+inline constexpr bool __use_unicode_execution_charset = false;
 #  elif defined(_MSVC_EXECUTION_CHARACTER_SET)
 // This is the same test MSVC STL uses in their implementation of <print>
 // See: https://learn.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
-inline constexpr bool __use_unicode = _MSVC_EXECUTION_CHARACTER_SET == 65001;
+inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTER_SET == 65001;
 #  else
-inline constexpr bool __use_unicode = true;
+inline constexpr bool __use_unicode_execution_charset = true;
 #  endif
 
 _LIBCPP_HIDE_FROM_ABI inline bool __is_terminal(FILE* __stream) {
@@ -329,7 +329,7 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
 template <class... _Args>
 _LIBCPP_HIDE_FROM_ABI void print(FILE* __stream, format_string<_Args...> __fmt, _Args&&... __args) {
 #  ifndef _LIBCPP_HAS_NO_UNICODE
-  if constexpr (__print::__use_unicode)
+  if constexpr (__print::__use_unicode_execution_charset)
     __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
   else
     __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), false);
@@ -349,7 +349,7 @@ _LIBCPP_HIDE_FROM_ABI void println(FILE* __stream, format_string<_Args...> __fmt
   // Note the wording in the Standard is inefficient. The output of
   // std::format is a std::string which is then copied. This solution
   // just appends a newline at the end of the output.
-  if constexpr (__print::__use_unicode)
+  if constexpr (__print::__use_unicode_execution_charset)
     __print::__vprint_unicode(__stream, __fmt.get(), std::make_format_args(__args...), true);
   else
     __print::__vprint_nonunicode(__stream, __fmt.get(), std::make_format_args(__args...), true);

@mordante mordante merged commit a8b3deb into llvm:main Jan 16, 2024
@mordante mordante deleted the renames___use_unicode branch January 16, 2024 16:32
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants