Skip to content

Commit

Permalink
[libc++] Fix unnecessary fflush() in __vprint_unicode() on POSIX
Browse files Browse the repository at this point in the history
Fixes #70142
  • Loading branch information
dimztimz committed Dec 19, 2023
1 parent 18e1179 commit 16de385
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 87 deletions.
11 changes: 1 addition & 10 deletions libcxx/include/print
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,6 @@ __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);
}

# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <class = void> // TODO PRINT template or availability markup fires too eagerly (http://llvm.org/PR61563).
Expand Down Expand Up @@ -310,7 +301,7 @@ __vprint_unicode([[maybe_unused]] FILE* __stream,
// Windows there is a different API. This API requires transcoding.

# ifndef _WIN32
__print::__vprint_unicode_posix(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
__print::__vprint_nonunicode(__stream, __fmt, __args, __write_nl);
# elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
__print::__vprint_unicode_windows(__stream, __fmt, __args, __write_nl, __print::__is_terminal(__stream));
# else
Expand Down

This file was deleted.

0 comments on commit 16de385

Please sign in to comment.