diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-10-07 20:41:48 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2019-10-07 20:41:48 +0300 |
commit | 29b50c514e41b1571649b4282d4f91dffbe27c3d (patch) | |
tree | bd51cc851b1a3237276f88dbbf9493111cd0bb40 | |
parent | dbf76606c10d325eee673b82173ec0897e0db3ff (diff) |
In theory superbuild will now work?!? Also patch in status code coroutine support.
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | include/llfio/revision.hpp | 6 | ||||
-rw-r--r-- | include/llfio/v2.0/status_code.hpp | 73 |
3 files changed, 15 insertions, 71 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f36ac09..f45d9d7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,10 +42,16 @@ if(NOT PROJECT_IS_DEPENDENCY) UpdateRevisionHppFromGit("${CMAKE_CURRENT_SOURCE_DIR}/include/llfio/revision.hpp") endif() # Find my library dependencies +find_quickcpplib_library(quickcpplib + GIT_REPOSITORY "https://github.com/ned14/quickcpplib.git" + REQUIRED + IS_HEADER_ONLY +) find_quickcpplib_library(outcome GIT_REPOSITORY "https://github.com/ned14/outcome.git" GIT_TAG "develop" REQUIRED + IS_HEADER_ONLY ) if(WIN32) add_subdirectory("include/llfio/ntkernel-error-category" EXCLUDE_FROM_ALL) @@ -226,6 +232,7 @@ if(NOT PROJECT_IS_DEPENDENCY) find_quickcpplib_library(kerneltest GIT_REPOSITORY "https://github.com/ned14/kerneltest.git" REQUIRED + IS_HEADER_ONLY ) foreach(test_target ${llfio_TEST_TARGETS}) target_link_libraries(${test_target} PRIVATE kerneltest::hl) diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index 3eece543..ed12ca20 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 1849f4e63413ea6f79ad50f18fba4c91bf7b28dd -#define LLFIO_PREVIOUS_COMMIT_DATE "2019-10-04 14:20:39 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE 1849f4e6 +#define LLFIO_PREVIOUS_COMMIT_REF dbf76606c10d325eee673b82173ec0897e0db3ff +#define LLFIO_PREVIOUS_COMMIT_DATE "2019-10-07 09:54:55 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE dbf76606 diff --git a/include/llfio/v2.0/status_code.hpp b/include/llfio/v2.0/status_code.hpp index 14a691c6..bd201ae1 100644 --- a/include/llfio/v2.0/status_code.hpp +++ b/include/llfio/v2.0/status_code.hpp @@ -57,6 +57,8 @@ as that (a) enables safe header only LLFIO on Windows (b) produces better codege // Bring in a result implementation based on status_code #include "outcome/experimental/status_result.hpp" #include "outcome/try.hpp" +// Bring in status code utility +#include "outcome/experimental/status-code/include/system_code_from_exception.hpp" #if __cpp_coroutines #include "outcome/experimental/coroutine_support.hpp" #ifdef OUTCOME_FOUND_COROUTINE_HEADER @@ -252,7 +254,7 @@ template <class T> using atomic_eager = OUTCOME_V2_NAMESPACE::experimental::awai template <class T> using atomic_lazy = OUTCOME_V2_NAMESPACE::experimental::awaitables::atomic_lazy<T>; template <class T> using eager = OUTCOME_V2_NAMESPACE::experimental::awaitables::eager<T>; template <class T> using lazy = OUTCOME_V2_NAMESPACE::experimental::awaitables::lazy<T>; -template <class T = void> using coroutine_handle = OUTCOME_V2_NAMESPACE::experimental::awaitables::coroutine_handle<T>; +template <class T = void> using coroutine_handle = OUTCOME_V2_NAMESPACE::awaitables::coroutine_handle<T>; #endif //! Choose an errc implementation @@ -274,74 +276,9 @@ namespace detail { inline std::ostream &operator<<(std::ostream &s, const file_io_error &v) { return s << "llfio::file_io_error(" << v.message().c_str() << ")"; } } // namespace detail -inline file_io_error error_from_exception(std::exception_ptr &&ep = std::current_exception(), file_io_error not_matched = generic_error(errc::resource_unavailable_try_again)) noexcept +inline file_io_error error_from_exception(std::exception_ptr &&ep = std::current_exception(), SYSTEM_ERROR2_NAMESPACE::system_code not_matched = errc::resource_unavailable_try_again) noexcept { - if(!ep) - { - return generic_error(errc::success); - } - try - { - std::rethrow_exception(ep); - } - catch(const std::invalid_argument & /*unused*/) - { - ep = std::exception_ptr(); - return generic_error(errc::invalid_argument); - } - catch(const std::domain_error & /*unused*/) - { - ep = std::exception_ptr(); - return generic_error(errc::argument_out_of_domain); - } - catch(const std::length_error & /*unused*/) - { - ep = std::exception_ptr(); - return generic_error(errc::argument_list_too_long); - } - catch(const std::out_of_range & /*unused*/) - { - ep = std::exception_ptr(); - return generic_error(errc::result_out_of_range); - } - catch(const std::logic_error & /*unused*/) /* base class for this group */ - { - ep = std::exception_ptr(); - return generic_error(errc::invalid_argument); - } - catch(const std::system_error &e) /* also catches ios::failure */ - { - ep = std::exception_ptr(); - if(e.code().category() == std::generic_category()) - { - return generic_error(static_cast<errc>(static_cast<int>(e.code().value()))); - } - // Don't know this error code category, so fall through - } - catch(const std::overflow_error & /*unused*/) - { - ep = std::exception_ptr(); - return generic_error(errc::value_too_large); - } - catch(const std::range_error & /*unused*/) - { - ep = std::exception_ptr(); - return generic_error(errc::result_out_of_range); - } - catch(const std::runtime_error & /*unused*/) /* base class for this group */ - { - ep = std::exception_ptr(); - return generic_error(errc::resource_unavailable_try_again); - } - catch(const std::bad_alloc & /*unused*/) - { - ep = std::exception_ptr(); - return generic_error(errc::not_enough_memory); - } - catch(...) - { - } - return not_matched; + return SYSTEM_ERROR2_NAMESPACE::system_code_from_exception(static_cast<std::exception_ptr &&>(ep), static_cast<SYSTEM_ERROR2_NAMESPACE::system_code &&>(not_matched)); } LLFIO_V2_NAMESPACE_END |