From c9f95115949eb5940e21bf89b79acfa0fa01b3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E7=8E=AE=E6=96=87?= Date: Mon, 3 Mar 2025 08:15:34 +0800 Subject: [PATCH] robin hood: resolve warning on new clang (#44) Clang has this weird behavior of setting __GNUC__ to 4, hence clang will always take the if branch. This is suboptimal because std::is_trivially_copyable has almost always been in clang. starting with clang 15 a warning is raised for the current implementation: warning: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Wdeprecated-builtins] Since we are using -Werror, we should fix this. --- src/common/utils/RobinHood.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/common/utils/RobinHood.h b/src/common/utils/RobinHood.h index 177cc2e..467fc01 100644 --- a/src/common/utils/RobinHood.h +++ b/src/common/utils/RobinHood.h @@ -203,14 +203,6 @@ static Counts &counts() { #define ROBIN_HOOD_PRIVATE_DEFINITION_BROKEN_CONSTEXPR() 0 #endif -// workaround missing "is_trivially_copyable" in g++ < 5.0 -// See https://stackoverflow.com/a/31798726/48181 -#if defined(__GNUC__) && __GNUC__ < 5 -#define ROBIN_HOOD_IS_TRIVIALLY_COPYABLE(...) __has_trivial_copy(__VA_ARGS__) -#else -#define ROBIN_HOOD_IS_TRIVIALLY_COPYABLE(...) std::is_trivially_copyable<__VA_ARGS__>::value -#endif - // helpers for C++ versions, see https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html #define ROBIN_HOOD_PRIVATE_DEFINITION_CXX() __cplusplus #define ROBIN_HOOD_PRIVATE_DEFINITION_CXX98() 199711L @@ -1382,7 +1374,7 @@ class Table : static_cast(std::distance(mKeyVals, reinterpret_cast_no_cast_align_warning(mInfo))); } - void cloneData(const Table &o) { Cloner()(o, *this); } + void cloneData(const Table &o) { Cloner::value>()(o, *this); } // inserts a keyval that is guaranteed to be new, e.g. when the hashmap is resized. // @return True on success, false if something went wrong