From 524ebb7ea91d2955dc4c68c7e6fd2bed620621b5 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Thu, 16 Nov 2023 07:25:40 -0800 Subject: Rollback providing AbslHashValue for std::filesystem::path in C++17 'path' is unavailable: introduced in iOS 13.0 PiperOrigin-RevId: 583036562 Change-Id: I5aea530d03c3317896c3c15bcf7cb5f9d8bc466a --- absl/hash/hash_test.cc | 41 ----------------------------------------- absl/hash/internal/hash.h | 22 ---------------------- 2 files changed, 63 deletions(-) (limited to 'absl/hash') diff --git a/absl/hash/hash_test.cc b/absl/hash/hash_test.cc index 71874061..111f375b 100644 --- a/absl/hash/hash_test.cc +++ b/absl/hash/hash_test.cc @@ -48,10 +48,6 @@ #include "absl/types/optional.h" #include "absl/types/variant.h" -#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L -#include // NOLINT -#endif - #ifdef ABSL_HAVE_STD_STRING_VIEW #include #endif @@ -484,43 +480,6 @@ TEST(HashValueTest, U32StringView) { #endif } -TEST(HashValueTest, StdFilesystemPath) { -#if ABSL_INTERNAL_CPLUSPLUS_LANG < 201703L - GTEST_SKIP() << "std::filesystem::path requires C++17"; -#else - EXPECT_TRUE((is_hashable::value)); - - // clang-format off - const auto kTestCases = std::make_tuple( - std::filesystem::path(), - std::filesystem::path("/"), -#ifndef __GLIBCXX__ - // libstdc++ has a known issue normalizing "//". - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106452 - std::filesystem::path("//"), -#endif - std::filesystem::path("/a/b"), - std::filesystem::path("/a//b"), - std::filesystem::path("a/b"), - std::filesystem::path("a/b/"), - std::filesystem::path("a//b"), - std::filesystem::path("a//b/"), - std::filesystem::path("c:/"), - std::filesystem::path("c:\\"), - std::filesystem::path("c:\\/"), - std::filesystem::path("c:\\//"), - std::filesystem::path("c://"), - std::filesystem::path("c://\\"), - std::filesystem::path("/e/p"), - std::filesystem::path("/s/../e/p"), - std::filesystem::path("e/p"), - std::filesystem::path("s/../e/p")); - // clang-format on - - EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(kTestCases)); -#endif -} - TEST(HashValueTest, StdArray) { EXPECT_TRUE((is_hashable>::value)); diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index 003f3dde..e97cb315 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h @@ -56,10 +56,6 @@ #include "absl/types/variant.h" #include "absl/utility/utility.h" -#if ABSL_INTERNAL_CPLUSPLUS_LANG >= 201703L -#include // NOLINT -#endif - #ifdef ABSL_HAVE_STD_STRING_VIEW #include #endif @@ -582,24 +578,6 @@ H AbslHashValue(H hash_state, std::basic_string_view str) { #endif // ABSL_HAVE_STD_STRING_VIEW -#if defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L - -// Support std::filesystem::path. The SFINAE is required because some string -// types are implicitly convertible to std::filesystem::path. -template >> -H AbslHashValue(H hash_state, const Path& path) { - // This is implemented by deferring to the standard library to compute the - // hash. The standard library requires that for two paths, `p1 == p2`, then - // `hash_value(p1) == hash_value(p2)`. `AbslHashValue` has the same - // requirement. Since `operator==` does platform specific matching, deferring - // to the standard library is the simplest approach. - return H::combine(std::move(hash_state), std::filesystem::hash_value(path)); -} - -#endif // defined(__cpp_lib_filesystem) && __cpp_lib_filesystem >= 201703L - // ----------------------------------------------------------------------------- // AbslHashValue for Sequence Containers // ----------------------------------------------------------------------------- -- cgit v1.2.3