[libcxx] r293543 - experimental: avoid using raw _WIN32 in filesystem
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 30 11:57:27 PST 2017
Author: compnerd
Date: Mon Jan 30 13:57:27 2017
New Revision: 293543
URL: http://llvm.org/viewvc/llvm-project?rev=293543&view=rev
Log:
experimental: avoid using raw _WIN32 in filesystem
Use the _LIBCPP_WIN32API macro instead of _WIN32 checks. Fix a missed
renaming for style conformance.
Modified:
libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp
Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=293543&r1=293542&r2=293543&view=diff
==============================================================================
--- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jan 30 13:57:27 2017
@@ -8,7 +8,8 @@
//===----------------------------------------------------------------------===//
#include "experimental/filesystem"
-#if defined(_WIN32)
+#include "__config"
+#if defined(_LIBCPP_WIN32API)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#else
@@ -20,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FIL
namespace { namespace detail {
-#if !defined(_WIN32)
+#if !defined(_LIBCPP_WIN32API)
inline error_code capture_errno() {
_LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
return error_code{errno, std::generic_category()};
@@ -40,7 +41,7 @@ inline bool set_or_throw(std::error_code
return false;
}
-#if !defined(_WIN32)
+#if !defined(_LIBCPP_WIN32API)
inline path::string_type posix_readdir(DIR *dir_stream, error_code& ec) {
struct dirent* dir_entry_ptr = nullptr;
errno = 0; // zero errno in order to detect errors
@@ -58,7 +59,7 @@ inline path::string_type posix_readdir(D
using detail::set_or_throw;
-#if defined(_WIN32)
+#if defined(_LIBCPP_WIN32API)
class __dir_stream {
public:
__dir_stream() = delete;
@@ -67,7 +68,7 @@ public:
__dir_stream(__dir_stream&& __ds) noexcept
: __stream_(__ds.__stream_), __root_(std::move(__ds.__root_)),
__entry_(std::move(__ds.__entry_)) {
- ds.__stream_ = INVALID_HANDLE_VALUE;
+ __ds.__stream_ = INVALID_HANDLE_VALUE;
}
__dir_stream(const path& root, directory_options opts, error_code& ec)
More information about the cfe-commits
mailing list