mirror of
https://github.com/martinus/unordered_dense.git
synced 2026-01-18 17:21:27 +01:00
Disable ubsan's integer sanitizer warnings
They crop up on valid per the standard (but sometimes bogus) uses of modular arithmetic on unsigned integers, such as in hash functions.
This commit is contained in:
committed by
Martin Leitner-Ankerl
parent
f9bd51faca
commit
b4802df020
@@ -70,6 +70,17 @@
|
||||
# define ANKERL_UNORDERED_DENSE_NOINLINE __attribute__((noinline))
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) && defined(__has_attribute)
|
||||
# if __has_attribute(__no_sanitize__)
|
||||
# define ANKERL_UNORDERED_DENSE_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK \
|
||||
__attribute__((__no_sanitize__("unsigned-integer-overflow")))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(ANKERL_UNORDERED_DENSE_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK)
|
||||
# define ANKERL_UNORDERED_DENSE_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
#endif
|
||||
|
||||
// defined in unordered_dense.cpp
|
||||
#if !defined(ANKERL_UNORDERED_DENSE_EXPORT)
|
||||
# define ANKERL_UNORDERED_DENSE_EXPORT
|
||||
@@ -351,7 +362,8 @@ struct tuple_hash_helper {
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] static auto mix64(uint64_t state, uint64_t v) -> uint64_t {
|
||||
[[nodiscard]] ANKERL_UNORDERED_DENSE_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static auto mix64(uint64_t state, uint64_t v)
|
||||
-> uint64_t {
|
||||
return detail::wyhash::mix(state + v, uint64_t{0x9ddfea08eb382d69});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user