diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-04-26 15:33:29 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-05-08 19:37:29 -0700 |
| commit | 06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76 (patch) | |
| tree | 1316711b92a43dd5c599e425b8693fa8e1e0c0b7 /lib/libcxx/src/print.cpp | |
| parent | bc6ebc6f2597fda1f98842c6f545751fef2a5334 (diff) | |
| download | zig-06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76.tar.gz zig-06ee65af9ed6aa5ee4d1d7f4fab9d7acecf66e76.zip | |
libcxx: update to LLVM 18
release/18.x branch, commit 78b99c73ee4b96fe9ce0e294d4632326afb2db42
This adds the flag `-D_LIBCPP_HARDENING_MODE` which is determined based
on the Zig optimization mode.
This commit also fixes libunwind, libcxx, and libcxxabi to properly
report sub compilation errors.
Diffstat (limited to 'lib/libcxx/src/print.cpp')
| -rw-r--r-- | lib/libcxx/src/print.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/libcxx/src/print.cpp b/lib/libcxx/src/print.cpp index 3d8a4c291e..8fa59fdd09 100644 --- a/lib/libcxx/src/print.cpp +++ b/lib/libcxx/src/print.cpp @@ -7,23 +7,27 @@ //===----------------------------------------------------------------------===// #include <__config> + #include <cstdlib> #include <print> +#include <__system_error/system_error.h> + +#include "filesystem/error.h" + #if defined(_LIBCPP_WIN32API) # define WIN32_LEAN_AND_MEAN # define NOMINMAX # include <io.h> # include <windows.h> - -# include <__system_error/system_error.h> - -# include "filesystem/error.h" +#elif __has_include(<unistd.h>) +# include <unistd.h> #endif _LIBCPP_BEGIN_NAMESPACE_STD -#ifdef _WIN32 +#if defined(_LIBCPP_WIN32API) + _LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream) { // Note the Standard does this in one call, but it's unclear whether // an invalid handle is allowed when calling GetConsoleMode. @@ -47,16 +51,14 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst __view.size(), nullptr, nullptr) == 0) { -# ifndef _LIBCPP_HAS_NO_EXCEPTIONS - // There is no __throw_system_error overload that takes an error code. - throw system_error{filesystem::detail::make_windows_error(GetLastError()), "failed to write formatted output"}; -# else // _LIBCPP_HAS_NO_EXCEPTIONS - std::abort(); -# endif // _LIBCPP_HAS_NO_EXCEPTIONS + __throw_system_error(filesystem::detail::make_windows_error(GetLastError()), "failed to write formatted output"); } } # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -#endif // _WIN32 +#elif __has_include(<unistd.h>) // !_LIBCPP_WIN32API + +_LIBCPP_EXPORTED_FROM_ABI bool __is_posix_terminal(FILE* __stream) { return isatty(fileno(__stream)); } +#endif _LIBCPP_END_NAMESPACE_STD |
