diff options
-rw-r--r-- | include/llfio/revision.hpp | 6 | ||||
-rw-r--r-- | include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp | 11 | ||||
-rw-r--r-- | include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp | 4 | ||||
-rw-r--r-- | include/llfio/v2.0/async_file_handle.hpp | 8 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp | 2 | ||||
-rw-r--r-- | include/llfio/v2.0/mapped_file_handle.hpp | 2 | ||||
m--------- | include/llfio/v2.0/outcome | 0 | ||||
-rw-r--r-- | include/llfio/v2.0/path_view.hpp | 59 | ||||
m--------- | include/llfio/v2.0/quickcpplib | 0 | ||||
m--------- | test/kerneltest | 0 |
10 files changed, 55 insertions, 37 deletions
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index 5cbdb23d..f878b670 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 3960a4c216e71896e1948c89d7150c5ee8b3ab44 -#define LLFIO_PREVIOUS_COMMIT_DATE "2019-09-05 20:22:26 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE 3960a4c2 +#define LLFIO_PREVIOUS_COMMIT_REF 01fc67d4f6a0bb5d9fe7bdeb1b68c290b9c69d80 +#define LLFIO_PREVIOUS_COMMIT_DATE "2019-09-05 21:26:14 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE 01fc67d4 diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp index 5e1b9807..9a1811b5 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/atomic_append.hpp @@ -33,6 +33,11 @@ Distributed under the Boost Software License, Version 1.0. //! \file atomic_append.hpp Provides algorithm::shared_fs_mutex::atomic_append +#if __GNUC__ >= 8 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclass-memaccess" +#endif + LLFIO_V2_NAMESPACE_BEGIN namespace algorithm @@ -59,6 +64,7 @@ namespace algorithm // Last byte is used to detect first user of the file }; static_assert(sizeof(header) == 128, "header structure is not 128 bytes long!"); + static_assert(std::is_trivially_copyable<header>::value, "header structure is not trivially copyable"); struct alignas(16) lock_request { @@ -74,6 +80,7 @@ namespace algorithm } }; static_assert(sizeof(lock_request) == 128, "lock_request structure is not 128 bytes long!"); + static_assert(std::is_trivially_copyable<lock_request>::value, "header structure is not trivially copyable"); #pragma pack(pop) } // namespace atomic_append_detail #endif @@ -558,5 +565,9 @@ namespace algorithm LLFIO_V2_NAMESPACE_END +#if __GNUC__ >= 8 +#pragma GCC diagnostic pop +#endif + #endif diff --git a/include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp b/include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp index 9e958054..c3e881b8 100644 --- a/include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp +++ b/include/llfio/v2.0/algorithm/shared_fs_mutex/base.hpp @@ -218,14 +218,14 @@ namespace algorithm { entities_guard ret(this, entities); OUTCOME_TRYV(_lock(ret, d, spin_not_sleep)); - return std::move(ret); + return {std::move(ret)}; } //! Lock a single entity for exclusive or shared access result<entities_guard> lock(entity_type entity, deadline d = deadline(), bool spin_not_sleep = false) noexcept { entities_guard ret(this, entity); OUTCOME_TRYV(_lock(ret, d, spin_not_sleep)); - return std::move(ret); + return {std::move(ret)}; } //! Try to lock all of a sequence of entities for exclusive or shared access result<entities_guard> try_lock(entities_type entities) noexcept { return lock(entities, deadline(std::chrono::seconds(0))); } diff --git a/include/llfio/v2.0/async_file_handle.hpp b/include/llfio/v2.0/async_file_handle.hpp index 3553e713..5b60b3fa 100644 --- a/include/llfio/v2.0/async_file_handle.hpp +++ b/include/llfio/v2.0/async_file_handle.hpp @@ -141,7 +141,7 @@ public: OUTCOME_TRY(v, file_handle::file(std::move(base), _path, _mode, _creation, _caching, flags | flag::overlapped)); async_file_handle ret(std::move(v)); ret._service = &service; - return std::move(ret); + return {std::move(ret)}; } /*! Create an async file handle creating a randomly named file on a path. @@ -209,7 +209,7 @@ public: OUTCOME_TRY(v, file_handle::temp_inode(dir, _mode, flags | flag::overlapped)); async_file_handle ret(std::move(v)); ret._service = &service; - return std::move(ret); + return {std::move(ret)}; } LLFIO_MAKE_FREE_FUNCTION @@ -223,14 +223,14 @@ public: OUTCOME_TRY(v, file_handle::clone(mode_, caching_, d)); async_file_handle ret(std::move(v)); ret._service = &service; - return std::move(ret); + return {std::move(ret)}; } LLFIO_HEADERS_ONLY_VIRTUAL_SPEC result<file_handle> clone(mode mode_ = mode::unchanged, caching caching_ = caching::unchanged, deadline d = std::chrono::seconds(30)) const noexcept { OUTCOME_TRY(v, file_handle::clone(mode_, caching_, d)); async_file_handle ret(std::move(v)); ret._service = _service; - return static_cast<file_handle &&>(ret); + return {static_cast<file_handle &&>(ret)}; } #if DOXYGEN_SHOULD_SKIP_THIS diff --git a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp index 2f870922..116ac4f5 100644 --- a/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/symlink_handle.ipp @@ -427,7 +427,7 @@ result<symlink_handle::buffers_type> symlink_handle::read(symlink_handle::io_req buffer[read] = 0; tofill._link = path_view(buffer, read); tofill._type = symlink_type::symbolic; - return std::move(tofill); + return {std::move(tofill)}; } } diff --git a/include/llfio/v2.0/mapped_file_handle.hpp b/include/llfio/v2.0/mapped_file_handle.hpp index 54edfa77..55f94617 100644 --- a/include/llfio/v2.0/mapped_file_handle.hpp +++ b/include/llfio/v2.0/mapped_file_handle.hpp @@ -280,7 +280,7 @@ public: { OUTCOME_TRY(v, file_handle::temp_inode(dir, _mode, flags)); mapped_file_handle ret(std::move(v)); - return std::move(ret); + return {std::move(ret)}; } //! The memory section this handle is using diff --git a/include/llfio/v2.0/outcome b/include/llfio/v2.0/outcome -Subproject be4d662241dd58c479dc8faebd0e6f59187eb3a +Subproject caa46678eb64ddc4293f3c16f82c854860f5bfa diff --git a/include/llfio/v2.0/path_view.hpp b/include/llfio/v2.0/path_view.hpp index 39140c36..c797a225 100644 --- a/include/llfio/v2.0/path_view.hpp +++ b/include/llfio/v2.0/path_view.hpp @@ -34,6 +34,13 @@ Distributed under the Boost Software License, Version 1.0. #pragma warning(disable : 4251) // dll interface #endif +// Stupid GCC 8 suddenly started erroring on use of lambdas in constexpr in C++ 14 :( +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ > 7 && __cplusplus < 201700 +#define LLFIO_PATH_VIEW_GCC_CONSTEXPR +#else +#define LLFIO_PATH_VIEW_GCC_CONSTEXPR constexpr +#endif + LLFIO_V2_NAMESPACE_EXPORT_BEGIN namespace detail @@ -252,18 +259,18 @@ public: constexpr void swap(path_view &o) noexcept { _state.swap(o._state); } //! True if empty - constexpr bool empty() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool empty() const noexcept { return _invoke([](const auto &v) { return v.empty(); }); } - constexpr bool has_root_path() const noexcept { return !root_path().empty(); } - constexpr bool has_root_name() const noexcept { return !root_name().empty(); } - constexpr bool has_root_directory() const noexcept { return !root_directory().empty(); } - constexpr bool has_relative_path() const noexcept { return !relative_path().empty(); } - constexpr bool has_parent_path() const noexcept { return !parent_path().empty(); } - constexpr bool has_filename() const noexcept { return !filename().empty(); } - constexpr bool has_stem() const noexcept { return !stem().empty(); } - constexpr bool has_extension() const noexcept { return !extension().empty(); } + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool has_root_path() const noexcept { return !root_path().empty(); } + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool has_root_name() const noexcept { return !root_name().empty(); } + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool has_root_directory() const noexcept { return !root_directory().empty(); } + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool has_relative_path() const noexcept { return !relative_path().empty(); } + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool has_parent_path() const noexcept { return !parent_path().empty(); } + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool has_filename() const noexcept { return !filename().empty(); } + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool has_stem() const noexcept { return !stem().empty(); } + LLFIO_PATH_VIEW_GCC_CONSTEXPR bool has_extension() const noexcept { return !extension().empty(); } constexpr bool is_absolute() const noexcept { auto sep_idx = _find_first_sep(); @@ -349,7 +356,7 @@ public: #endif //! Adjusts the end of this view to match the final separator. - constexpr void remove_filename() noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR void remove_filename() noexcept { auto sep_idx = _find_last_sep(); _invoke([sep_idx](auto &v) { @@ -364,12 +371,12 @@ public: }); } //! Returns the size of the view in characters. - constexpr size_t native_size() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR size_t native_size() const noexcept { return _invoke([](const auto &v) { return v.size(); }); } //! Returns a view of the root name part of this view e.g. C: - constexpr path_view root_name() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR path_view root_name() const noexcept { auto sep_idx = _find_first_sep(); if(_npos == sep_idx) @@ -379,7 +386,7 @@ public: return _invoke([sep_idx](const auto &v) { return path_view(v.data(), sep_idx); }); } //! Returns a view of the root directory, if there is one e.g. / - constexpr path_view root_directory() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR path_view root_directory() const noexcept { auto sep_idx = _find_first_sep(); if(_npos == sep_idx) @@ -402,7 +409,7 @@ public: }); } //! Returns, if any, a view of the root path part of this view e.g. C:/ - constexpr path_view root_path() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR path_view root_path() const noexcept { auto sep_idx = _find_first_sep(); if(_npos == sep_idx) @@ -436,7 +443,7 @@ public: }); } //! Returns a view of everything after the root path - constexpr path_view relative_path() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR path_view relative_path() const noexcept { auto sep_idx = _find_first_sep(); if(_npos == sep_idx) @@ -466,7 +473,7 @@ public: }); } //! Returns a view of the everything apart from the filename part of this view - constexpr path_view parent_path() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR path_view parent_path() const noexcept { auto sep_idx = _find_last_sep(); if(_npos == sep_idx) @@ -476,7 +483,7 @@ public: return _invoke([sep_idx](const auto &v) { return path_view(v.data(), sep_idx); }); } //! Returns a view of the filename part of this view. - constexpr path_view filename() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR path_view filename() const noexcept { auto sep_idx = _find_last_sep(); if(_npos == sep_idx) @@ -486,7 +493,7 @@ public: return _invoke([sep_idx](const auto &v) { return path_view(v.data() + sep_idx + 1, v.size() - sep_idx - 1); }); } //! Returns a view of the filename without any file extension - constexpr path_view stem() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR path_view stem() const noexcept { auto sep_idx = _find_last_sep(); return _invoke([sep_idx](const auto &v) { @@ -499,7 +506,7 @@ public: }); } //! Returns a view of the file extension part of this view - constexpr path_view extension() const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR path_view extension() const noexcept { auto sep_idx = _find_last_sep(); return _invoke([sep_idx](const auto &v) { @@ -531,7 +538,7 @@ public: /*! Compares the two string views via the view's `compare()` which in turn calls `traits::compare()`. Be aware that on Windows a conversion from UTF-8 to UTF-16 is performed if needed. */ - constexpr int compare(const path_view &p) const noexcept + LLFIO_PATH_VIEW_GCC_CONSTEXPR int compare(const path_view &p) const noexcept { return _invoke([&p](const auto &v) { return -p.compare(v); }); } @@ -667,7 +674,7 @@ public: }; friend struct c_str; }; -inline constexpr bool operator==(path_view x, path_view y) noexcept +inline LLFIO_PATH_VIEW_GCC_CONSTEXPR bool operator==(path_view x, path_view y) noexcept { if(x.native_size() != y.native_size()) { @@ -675,7 +682,7 @@ inline constexpr bool operator==(path_view x, path_view y) noexcept } return x.compare(y) == 0; } -inline constexpr bool operator!=(path_view x, path_view y) noexcept +inline LLFIO_PATH_VIEW_GCC_CONSTEXPR bool operator!=(path_view x, path_view y) noexcept { if(x.native_size() != y.native_size()) { @@ -683,19 +690,19 @@ inline constexpr bool operator!=(path_view x, path_view y) noexcept } return x.compare(y) != 0; } -inline constexpr bool operator<(path_view x, path_view y) noexcept +inline LLFIO_PATH_VIEW_GCC_CONSTEXPR bool operator<(path_view x, path_view y) noexcept { return x.compare(y) < 0; } -inline constexpr bool operator>(path_view x, path_view y) noexcept +inline LLFIO_PATH_VIEW_GCC_CONSTEXPR bool operator>(path_view x, path_view y) noexcept { return x.compare(y) > 0; } -inline constexpr bool operator<=(path_view x, path_view y) noexcept +inline LLFIO_PATH_VIEW_GCC_CONSTEXPR bool operator<=(path_view x, path_view y) noexcept { return x.compare(y) <= 0; } -inline constexpr bool operator>=(path_view x, path_view y) noexcept +inline LLFIO_PATH_VIEW_GCC_CONSTEXPR bool operator>=(path_view x, path_view y) noexcept { return x.compare(y) >= 0; } diff --git a/include/llfio/v2.0/quickcpplib b/include/llfio/v2.0/quickcpplib -Subproject 05bc92fc3850c42ae2583ebfd8d13b0265e2687 +Subproject af4fd20c2adec666b23b77f1490a5fab3d92ffb diff --git a/test/kerneltest b/test/kerneltest -Subproject 1b51b13679f0bf868ccb0896595cb367f55c2d2 +Subproject 6290685726a577fc9a07223ce67aaca9ad1a9d3 |