diff options
Diffstat (limited to 'src/other_tools')
-rw-r--r-- | src/other_tools/ops_maps/TARGETS | 2 | ||||
-rw-r--r-- | src/other_tools/ops_maps/critical_git_op_map.hpp | 9 | ||||
-rw-r--r-- | src/other_tools/ops_maps/import_to_git_map.hpp | 5 | ||||
-rw-r--r-- | src/other_tools/root_maps/TARGETS | 1 | ||||
-rw-r--r-- | src/other_tools/root_maps/fpath_git_map.hpp | 17 |
5 files changed, 9 insertions, 25 deletions
diff --git a/src/other_tools/ops_maps/TARGETS b/src/other_tools/ops_maps/TARGETS index c270978a..21a63306 100644 --- a/src/other_tools/ops_maps/TARGETS +++ b/src/other_tools/ops_maps/TARGETS @@ -7,6 +7,7 @@ [ ["src/buildtool/multithreading", "async_map_consumer"] , ["src/other_tools/git_operations", "git_operations"] , ["src/utils/cpp", "hash_combine"] + , ["src/utils/cpp", "path_hash"] ] , "stage": ["src", "other_tools", "ops_maps"] } @@ -20,6 +21,7 @@ , ["src/other_tools/git_operations", "git_repo_remote"] , ["@", "fmt", "", "fmt"] , ["src/utils/cpp", "path"] + , ["src/utils/cpp", "path_hash"] ] , "stage": ["src", "other_tools", "ops_maps"] , "private-deps": diff --git a/src/other_tools/ops_maps/critical_git_op_map.hpp b/src/other_tools/ops_maps/critical_git_op_map.hpp index bb9b2765..58c2d3a1 100644 --- a/src/other_tools/ops_maps/critical_git_op_map.hpp +++ b/src/other_tools/ops_maps/critical_git_op_map.hpp @@ -22,6 +22,7 @@ #include "src/buildtool/multithreading/async_map_consumer.hpp" #include "src/other_tools/git_operations/git_operations.hpp" #include "src/utils/cpp/hash_combine.hpp" +#include "src/utils/cpp/path_hash.hpp" using GitOpKeyMap = std::unordered_map< GitOpType, @@ -66,7 +67,7 @@ class CriticalGitOpGuard { // making sure only one thread at a time processes this section std::scoped_lock<std::mutex> const lock(critical_key_mutex_); auto target_path_key = - std::filesystem::hash_value(new_key.params.target_path); + std::hash<std::filesystem::path>{}(new_key.params.target_path); if (curr_critical_key_.contains(target_path_key)) { GitOpKey old_key = curr_critical_key_[target_path_key]; // return stored key @@ -89,11 +90,7 @@ struct hash<GitOpParams> { [[nodiscard]] auto operator()(GitOpParams const& ct) const noexcept -> std::size_t { size_t seed{}; - // hash_value is used due to a bug in stdlibc++ which makes - // std::hash<std::filesystem::path>{}() fail with `temporary of type - // '__hash_enum<std::filesystem::__cxx11::path>' has private destructor` - hash_combine<size_t>(&seed, - std::filesystem::hash_value(ct.target_path)); + hash_combine<std::filesystem::path>(&seed, ct.target_path); hash_combine<std::string>(&seed, ct.git_hash); hash_combine<std::string>(&seed, ct.branch); return seed; diff --git a/src/other_tools/ops_maps/import_to_git_map.hpp b/src/other_tools/ops_maps/import_to_git_map.hpp index ee0b3c8f..487bae7c 100644 --- a/src/other_tools/ops_maps/import_to_git_map.hpp +++ b/src/other_tools/ops_maps/import_to_git_map.hpp @@ -21,6 +21,7 @@ #include "src/other_tools/git_operations/git_repo_remote.hpp" #include "src/other_tools/ops_maps/critical_git_op_map.hpp" #include "src/utils/cpp/path.hpp" +#include "src/utils/cpp/path_hash.hpp" struct CommitInfo { std::filesystem::path target_path{}; /*key*/ @@ -45,9 +46,7 @@ template <> struct hash<CommitInfo> { [[nodiscard]] auto operator()(CommitInfo const& ct) const noexcept -> std::size_t { - // hash_value is used due to a bug in stdlibc++ - // (see critical_git_op_map.hpp) - return std::filesystem::hash_value(ct.target_path); + return std::hash<std::filesystem::path>{}(ct.target_path); } }; } // namespace std diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS index d2bb01a3..e4bc6990 100644 --- a/src/other_tools/root_maps/TARGETS +++ b/src/other_tools/root_maps/TARGETS @@ -49,6 +49,7 @@ , "deps": [ ["src/other_tools/ops_maps", "import_to_git_map"] , ["@", "json", "", "json"] + , ["src/utils/cpp", "path_hash"] ] , "stage": ["src", "other_tools", "root_maps"] , "private-deps": diff --git a/src/other_tools/root_maps/fpath_git_map.hpp b/src/other_tools/root_maps/fpath_git_map.hpp index 7f772eff..9b209163 100644 --- a/src/other_tools/root_maps/fpath_git_map.hpp +++ b/src/other_tools/root_maps/fpath_git_map.hpp @@ -17,26 +17,11 @@ #include "nlohmann/json.hpp" #include "src/other_tools/ops_maps/import_to_git_map.hpp" +#include "src/utils/cpp/path_hash.hpp" /// \brief Maps the path to a repo on the file system to its Git tree WS root. using FilePathGitMap = AsyncMapConsumer<std::filesystem::path, nlohmann::json>; -#if (defined(__GLIBCXX__) and _GLIBCXX_RELEASE < 12) or \ - (defined(_LIBCPP_VERSION) and _LIBCPP_VERSION < 16000) -// std::hash<std::filesystem::path> is missing for -// - GNU's libstdc++ < 12 -// - LLVM's libcxx < 16 (see https://reviews.llvm.org/D125394) -namespace std { -template <> -struct hash<std::filesystem::path> { - [[nodiscard]] auto operator()( - std::filesystem::path const& ct) const noexcept -> std::size_t { - return std::filesystem::hash_value(ct); - } -}; -} // namespace std -#endif - [[nodiscard]] auto CreateFilePathGitMap( std::optional<std::string> const& current_subcmd, gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map, |