[libcxx-commits] [libcxx] [libc++] Fix checks for terminal and flushes in std::print() (PR #70321)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 10 08:29:46 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions ,h,cpp -- libcxx/include/__ostream/print.h libcxx/include/print libcxx/src/print.cpp libcxx/test/libcxx/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/print b/libcxx/include/print
index c9651ccc8..f5e7993fa 100644
--- a/libcxx/include/print
+++ b/libcxx/include/print
@@ -195,17 +195,17 @@ inline constexpr bool __use_unicode_execution_charset = _MSVC_EXECUTION_CHARACTE
inline constexpr bool __use_unicode_execution_charset = true;
# endif
-#if defined(_LIBCPP_WIN32API) && _LIBCPP_AVAILABILITY_HAS_PRINT
+# if defined(_LIBCPP_WIN32API) && _LIBCPP_AVAILABILITY_HAS_PRINT
_LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream) {
// The macro _LIBCPP_TESTING_PRINT_IS_TERMINAL is used to change
// the behavior in the test. This is not part of the public API.
-# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
+# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream);
-# else
+# else
return std::__is_windows_terminal(__stream);
-# endif
+# endif
}
-#endif
+# endif
template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
_LIBCPP_HIDE_FROM_ABI inline void
``````````
</details>
https://github.com/llvm/llvm-project/pull/70321
More information about the libcxx-commits
mailing list