[all-commits] [llvm/llvm-project] 1616fb: [libc++] Fix checks for terminal and flushes in st...

Dimitrij Mijoski via All-commits all-commits at lists.llvm.org
Thu Mar 12 02:58:58 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1616fbaccf824620e92ccd29cc66557f4a84031e
      https://github.com/llvm/llvm-project/commit/1616fbaccf824620e92ccd29cc66557f4a84031e
  Author: Dimitrij Mijoski <dmjpp at hotmail.com>
  Date:   2026-03-12 (Thu, 12 Mar 2026)

  Changed paths:
    M .github/workflows/libcxx-build-and-test.yaml
    M libcxx/CMakeLists.txt
    R libcxx/cmake/caches/Generic-no-terminal.cmake
    M libcxx/include/__config_site.in
    M libcxx/include/__configuration/availability.h
    M libcxx/include/__ostream/print.h
    M libcxx/include/print
    M libcxx/src/print.cpp
    M libcxx/test/libcxx/input.output/iostream.format/output.streams/ostream.formatted/ostream.formatted.print/vprint_unicode.pass.cpp
    R libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_posix.pass.cpp
    M libcxx/test/libcxx/input.output/iostream.format/print.fun/vprint_unicode_windows.pass.cpp
    M libcxx/utils/ci/run-buildbot
    M libcxx/utils/libcxx/test/features/libcxx_macros.py

  Log Message:
  -----------
  [libc++] Fix checks for terminal and flushes in std::print() (#70321)

The check whether a stream is associated with a terminal or not and the
flushing of the stream in `std::print()` is needed only on Windows.
Additionally, the correct flush should be used. When `std::print` is
called with a C stream, `std::fflush()` should be used. When it is
called with C++ `ostream`, `ostream::flush()` should be called.

Because POSIX does not have a separate Unicode API for terminal output,
checking for terminal (`isatty`) and flushing is not needed at all.
Moreover, `isatty` has noticeable performance cost.

See also https://wg21.link/LWG4044.

Fixes #70142



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list