refs #39, remove DWORD dependency in forwarding mode and change test to trigger an error if there is a dependency to windows.h

This commit is contained in:
Steffen Schümann 2019-11-22 18:46:21 +01:00
parent c97ac97b30
commit 5a933d5c52
2 changed files with 14 additions and 12 deletions

View File

@ -1086,7 +1086,7 @@ enum class portable_error {
}; };
GHC_FS_API std::error_code make_error_code(portable_error err); GHC_FS_API std::error_code make_error_code(portable_error err);
#ifdef GHC_OS_WINDOWS #ifdef GHC_OS_WINDOWS
GHC_FS_API std::error_code make_system_error(DWORD err = 0); GHC_FS_API std::error_code make_system_error(uint32_t err = 0);
#else #else
GHC_FS_API std::error_code make_system_error(int err = 0); GHC_FS_API std::error_code make_system_error(int err = 0);
#endif #endif
@ -1141,7 +1141,7 @@ GHC_INLINE std::error_code make_error_code(portable_error err)
} }
#ifdef GHC_OS_WINDOWS #ifdef GHC_OS_WINDOWS
GHC_INLINE std::error_code make_system_error(DWORD err) GHC_INLINE std::error_code make_system_error(uint32_t err)
{ {
return std::error_code(err ? static_cast<int>(err) : static_cast<int>(::GetLastError()), std::system_category()); return std::error_code(err ? static_cast<int>(err) : static_cast<int>(::GetLastError()), std::system_category());
} }

View File

@ -37,21 +37,14 @@
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <set>
#include <random> #include <random>
#include <set>
#include <sstream> #include <sstream>
#include <thread> #include <thread>
#if defined(WIN32) || defined(_WIN32)
#ifndef __GNUC__ #if (defined(WIN32) || defined(_WIN32)) && !defined(__GNUC__)
#define NOMINMAX 1 #define NOMINMAX 1
#endif #endif
#include <windows.h>
#else
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#endif
#ifdef USE_STD_FS #ifdef USE_STD_FS
#include <filesystem> #include <filesystem>
@ -84,6 +77,15 @@ using fstream = ghc::filesystem::fstream;
} // namespace fs } // namespace fs
#endif #endif
#if defined(WIN32) || defined(_WIN32)
#include <windows.h>
#else
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#endif
#ifndef GHC_FILESYSTEM_FWD_TEST #ifndef GHC_FILESYSTEM_FWD_TEST
#define CATCH_CONFIG_MAIN #define CATCH_CONFIG_MAIN
#endif #endif