diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-11-15 20:29:01 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-11-15 20:29:01 +0300 |
commit | b6c21fdf2dcf0f7c72e117cfc8396fdbb9d5973c (patch) | |
tree | 4fbd54284bf9d1014635988bfd6b50298234719f | |
parent | 1ebceb7e076b3d6d0f51f185f94d65493e26f192 (diff) |
Workarounds for VS2019 16.3.
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | include/llfio/revision.hpp | 6 | ||||
-rw-r--r-- | include/llfio/v2.0/config.hpp | 7 | ||||
-rw-r--r-- | include/llfio/v2.0/path_view.hpp | 13 |
4 files changed, 22 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 112bd8a2..cfb87f0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,12 @@ if(NOT MSVC OR CMAKE_VERSION VERSION_GREATER 3.59) cxx_variable_templates ) endif() +# If on VS2019 16.3 or later, we require C++ 17 +if(MSVC AND MSVC_VERSION VERSION_GREATER_EQUAL 1923) + all_compile_features(PUBLIC + cxx_std_17 + ) +endif() # Set the library dependencies this library has all_link_libraries(PUBLIC quickcpplib::hl outcome::hl Threads::Threads) # Set the system dependencies this library has diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index 6f771274..e13e53cd 100644 --- a/include/llfio/revision.hpp +++ b/include/llfio/revision.hpp @@ -1,4 +1,4 @@ // Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time -#define LLFIO_PREVIOUS_COMMIT_REF 8ddf2ae04cf4ae8134bb14c1da33a99e05615edd -#define LLFIO_PREVIOUS_COMMIT_DATE "2019-10-16 12:22:38 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE 8ddf2ae0 +#define LLFIO_PREVIOUS_COMMIT_REF 1ebceb7e076b3d6d0f51f185f94d65493e26f192 +#define LLFIO_PREVIOUS_COMMIT_DATE "2019-10-19 18:01:38 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE 1ebceb7e diff --git a/include/llfio/v2.0/config.hpp b/include/llfio/v2.0/config.hpp index 607c7f76..547d8730 100644 --- a/include/llfio/v2.0/config.hpp +++ b/include/llfio/v2.0/config.hpp @@ -222,17 +222,20 @@ LLFIO_V2_NAMESPACE_END // Bring in filesystem #if defined(__has_include) // clang-format off -#if __has_include(<filesystem>) && __cplusplus >= 201700 +#if __has_include(<filesystem>) && (__cplusplus >= 201700 || _HAS_CXX17) #include <filesystem> LLFIO_V2_NAMESPACE_BEGIN namespace filesystem = std::filesystem; LLFIO_V2_NAMESPACE_END -#elif __has_include(<experimental/filesystem>) +#elif __has_include(<experimental/filesystem>) && (!defined(_MSC_VER) || _MSC_VER < 1923) // C++ 14 filesystem support was dropped in VS2019 16.3 #include <experimental/filesystem> LLFIO_V2_NAMESPACE_BEGIN namespace filesystem = std::experimental::filesystem; LLFIO_V2_NAMESPACE_END #elif __has_include(<filesystem>) +#if defined(_MSC_VER) && _MSC_VER >= 1923 +#error MSVC dropped support for C++ 14 <filesystem> from VS2019 16.3 onwards. Please enable C++ 17 or later. +#endif #include <filesystem> LLFIO_V2_NAMESPACE_BEGIN namespace filesystem = std::filesystem; diff --git a/include/llfio/v2.0/path_view.hpp b/include/llfio/v2.0/path_view.hpp index 12c14e31..1995447e 100644 --- a/include/llfio/v2.0/path_view.hpp +++ b/include/llfio/v2.0/path_view.hpp @@ -45,9 +45,7 @@ Distributed under the Boost Software License, Version 1.0. #endif #ifndef LLFIO_PATH_VIEW_CHAR8_TYPE_EMULATED -#if(defined(_MSC_VER) && !defined(__clang__) && !_HAS_CXX20) \ - || (defined(__GNUC__) && !defined(__clang__) && !defined(__CHAR8_TYPE__)) \ - || (defined(__clang__) && !defined(__CHAR8_TYPE__) && (__cplusplus < 201703L || __clang_major__ < 9)) +#if(defined(_MSC_VER) && !defined(__clang__) && !_HAS_CXX20) || (defined(__GNUC__) && !defined(__clang__) && !defined(__CHAR8_TYPE__)) || (defined(__clang__) && !defined(__CHAR8_TYPE__) && (__cplusplus < 201703L || __clang_major__ < 9)) #define LLFIO_PATH_VIEW_CHAR8_TYPE_EMULATED 1 #else #define LLFIO_PATH_VIEW_CHAR8_TYPE_EMULATED 0 @@ -68,6 +66,9 @@ namespace detail } #if LLFIO_PATH_VIEW_CHAR8_TYPE_EMULATED +#ifdef _MSC_VER // MSVC's standard library refuses any basic_string_view<T> where T is not an unsigned type + using char8_t = unsigned char; +#else struct char8_t { char v; @@ -86,6 +87,7 @@ namespace detail constexpr inline bool operator==(char8_t a, char8_t b) noexcept { return a.v == b.v; } constexpr inline bool operator!=(char8_t a, char8_t b) noexcept { return a.v != b.v; } #endif +#endif #if !defined(__CHAR16_TYPE__) && !defined(_MSC_VER) // VS2015 onwards has built in char16_t enum class char16_t : unsigned short { @@ -320,7 +322,7 @@ public: path_view_component &operator=(const path_view_component &) = default; path_view_component &operator=(path_view_component &&) = default; ~path_view_component() = default; - + const byte *_raw_data() const noexcept { return _bytestr; } //! True if empty @@ -789,7 +791,8 @@ inline LLFIO_PATH_VIEW_CONSTEXPR bool operator!=(path_view_component x, path_vie } LLFIO_TEMPLATE(class CharT) LLFIO_TREQUIRES(LLFIO_TPRED(path_view_component::is_source_acceptable<CharT>)) -inline constexpr bool operator==(path_view_component /*unused*/, const CharT * /*unused*/) noexcept { +inline constexpr bool operator==(path_view_component /*unused*/, const CharT * /*unused*/) noexcept +{ static_assert(!path_view_component::is_source_acceptable<CharT>, "Do not use operator== with path_view_component and a string literal, use .compare<>()"); return false; } |