Skip to content

Commit 25a2d51

Browse files
authored
[libc++] Guard the whole print.cpp file with _LIBCPP_WIN32API (#71122)
The print.cpp source file is only used when building on Windows. Avoid including anything else but <__config> in the file in the case where there's nothing to compile here at all. As a drive-by change, use _LIBCPP_WIN32API consistently instead of _WIN32.
1 parent 2b4b26e commit 25a2d51

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libcxx/src/print.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
//===----------------------------------------------------------------------===//
88

99
#include <__config>
10-
#include <cstdlib>
11-
#include <print>
1210

1311
#if defined(_LIBCPP_WIN32API)
12+
13+
# include <cstdlib>
14+
# include <print>
15+
1416
# define WIN32_LEAN_AND_MEAN
1517
# define NOMINMAX
1618
# include <io.h>
@@ -19,11 +21,9 @@
1921
# include <__system_error/system_error.h>
2022

2123
# include "filesystem/error.h"
22-
#endif
2324

2425
_LIBCPP_BEGIN_NAMESPACE_STD
2526

26-
#ifdef _WIN32
2727
_LIBCPP_EXPORTED_FROM_ABI bool __is_windows_terminal(FILE* __stream) {
2828
// Note the Standard does this in one call, but it's unclear whether
2929
// an invalid handle is allowed when calling GetConsoleMode.
@@ -52,6 +52,6 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst
5252
}
5353
# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
5454

55-
#endif // _WIN32
56-
5755
_LIBCPP_END_NAMESPACE_STD
56+
57+
#endif // !_LIBCPP_WIN32API

0 commit comments

Comments
 (0)