[libcxx-commits] [libcxx] [libc++] Fix checks for terminal and flushes in std::print() (PR #70321)

Dimitrij Mijoski via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 10 06:29:59 PDT 2026


================
@@ -236,26 +236,11 @@ __vprint_nonunicode(FILE* __stream, string_view __fmt, format_args __args, bool
 // terminal when the output is redirected. Typically during testing the
 // output is redirected to be able to capture it. This makes it hard to
 // test this code path.
-template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
-_LIBCPP_HIDE_FROM_ABI inline void
-__vprint_unicode_posix(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) {
-  // TODO PRINT Should flush errors throw too?
-  if (__is_terminal)
-    std::fflush(__stream);
-
-  __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl);
-}
 
 #      if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
 _LIBCPP_HIDE_FROM_ABI inline void
-__vprint_unicode_windows(FILE* __stream, string_view __fmt, format_args __args, bool __write_nl, bool __is_terminal) {
-  if (!__is_terminal)
-    return __print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl);
-
-  // TODO PRINT Should flush errors throw too?
-  std::fflush(__stream);
----------------
dimztimz wrote:

And the LWG issue wg21.link/lwg4044.

https://github.com/llvm/llvm-project/pull/70321


More information about the libcxx-commits mailing list