Skip to content

Commit 454bcc3

Browse files
committed
[libcxx] Make terminal check always false for print on GPU
Summary: This check must be handled in order to compile. The GPU cannot easily determine if a given `FILE *` is a terminal because the `stdio` interface is actually a wrapper over the system's `FILE *`, so we can't really detect it easily. An RPC call could be made to `isatty` if we really need to support this in the future.
1 parent ebdcb76 commit 454bcc3

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

libcxx/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ option(LIBCXX_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of win32
297297
option(LIBCXX_HAS_EXTERNAL_THREAD_API
298298
"Build libc++ with an externalized threading API.
299299
This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF)
300+
option(LIBCXX_HAS_TERMINAL_AVAILABLE "Build libc++ with terminal checking support" ON)
300301

301302
if (LIBCXX_ENABLE_THREADS)
302303
set(LIBCXX_PSTL_BACKEND "std_thread" CACHE STRING "Which PSTL backend to use")
@@ -744,6 +745,7 @@ config_define_if(LIBCXX_ABI_FORCE_ITANIUM _LIBCPP_ABI_FORCE_ITANIUM)
744745
config_define_if(LIBCXX_ABI_FORCE_MICROSOFT _LIBCPP_ABI_FORCE_MICROSOFT)
745746
config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
746747
config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
748+
config_define_if_not(LIBCXX_HAS_TERMINAL_AVAILABLE _LIBCPP_HAS_NO_TERMINAL)
747749
if (NOT LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION STREQUAL "default")
748750
config_define("${LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION}" _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION)
749751
endif()

libcxx/include/__config_site.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT
1616
#cmakedefine _LIBCPP_HAS_NO_THREADS
1717
#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
18+
#cmakedefine _LIBCPP_HAS_NO_TERMINAL
1819
#cmakedefine _LIBCPP_HAS_MUSL_LIBC
1920
#cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD
2021
#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL

libcxx/include/print

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ _LIBCPP_HIDE_FROM_ABI inline bool __is_terminal([[maybe_unused]] FILE* __stream)
199199
// the behavior in the test. This is not part of the public API.
200200
# ifdef _LIBCPP_TESTING_PRINT_IS_TERMINAL
201201
return _LIBCPP_TESTING_PRINT_IS_TERMINAL(__stream);
202-
# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0
202+
# elif _LIBCPP_AVAILABILITY_HAS_PRINT == 0 || _LIBCPP_HAS_NO_TERMINAL
203203
return false;
204204
# elif defined(_LIBCPP_WIN32API)
205205
return std::__is_windows_terminal(__stream);

0 commit comments

Comments
 (0)