This is an automated email from the ASF dual-hosted git repository. joemcdonnell pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 065c41d719063144cfa94966ca469513e9e3f4b5 Author: Sebastian Pop <[email protected]> AuthorDate: Thu May 4 15:59:29 2023 +0000 IMPALA-12119: rename FORCE_INLINE to avoid name collision Compiling impala on arm64 fails with an error of redefined FORCE_INLINE preprocessor macro: /home/spop/impala/be/src/util/sse2neon.h:48: error: "FORCE_INLINE" redefined [-Werror] 48 | #define FORCE_INLINE static inline {}attribute{}((always_inline)) | In file included from /home/spop/impala/be/src/codegen/llvm-codegen-cache.h:30, from /home/spop/impala/be/src/runtime/exec-env.cc:27: /home/spop/impala/be/src/thirdparty/datasketches/MurmurHash3.h:45: note: this is the location of the previous definition 45 | #define FORCE_INLINE inline {}attribute{}((always_inline)) | This patch renames FORCE_INLINE in MurmurHash3.h following the patch in datasketches: https://github.com/apache/datasketches-cpp/commit/0d8a17de0dc18493eb17e6613ad1534d6ff247b7 Change-Id: I78205eba25628a7f526208231aa4ff06c6d746af Reviewed-on: http://gerrit.cloudera.org:8080/19839 Reviewed-by: Daniel Becker <[email protected]> Reviewed-by: Joe McDonnell <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- be/src/thirdparty/datasketches/MurmurHash3.h | 51 +++++++++++++--------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/be/src/thirdparty/datasketches/MurmurHash3.h b/be/src/thirdparty/datasketches/MurmurHash3.h index c1cbeab11..450fd474d 100644 --- a/be/src/thirdparty/datasketches/MurmurHash3.h +++ b/be/src/thirdparty/datasketches/MurmurHash3.h @@ -27,14 +27,13 @@ typedef unsigned char uint8_t; typedef unsigned int uint32_t; typedef unsigned __int64 uint64_t; -#define FORCE_INLINE __forceinline +#define MURMUR3_FORCE_INLINE __forceinline #include <stdlib.h> -#define ROTL32(x,y) _rotl(x,y) -#define ROTL64(x,y) _rotl64(x,y) +#define MURMUR3_ROTL64(x,y) _rotl64(x,y) -#define BIG_CONSTANT(x) (x) +#define MURMUR3_BIG_CONSTANT(x) (x) // Other compilers @@ -42,22 +41,16 @@ typedef unsigned __int64 uint64_t; #include <stdint.h> -#define FORCE_INLINE inline __attribute__((always_inline)) - -inline uint32_t rotl32 ( uint32_t x, int8_t r ) -{ - return (x << r) | (x >> (32 - r)); -} +#define MURMUR3_FORCE_INLINE inline __attribute__((always_inline)) inline uint64_t rotl64 ( uint64_t x, int8_t r ) { return (x << r) | (x >> (64 - r)); } -#define ROTL32(x,y) rotl32(x,y) -#define ROTL64(x,y) rotl64(x,y) +#define MURMUR3_ROTL64(x,y) rotl64(x,y) -#define BIG_CONSTANT(x) (x##LLU) +#define MURMUR3_BIG_CONSTANT(x) (x##LLU) #endif // !defined(_MSC_VER) @@ -76,7 +69,7 @@ typedef struct { // Block read - if your platform needs to do endian-swapping or can only // handle aligned reads, do the conversion here -FORCE_INLINE uint64_t getblock64 ( const uint64_t * p, int i ) +MURMUR3_FORCE_INLINE uint64_t getblock64 ( const uint64_t * p, int i ) { return p[i]; } @@ -84,20 +77,20 @@ FORCE_INLINE uint64_t getblock64 ( const uint64_t * p, int i ) //----------------------------------------------------------------------------- // Finalization mix - force all bits of a hash block to avalanche -FORCE_INLINE uint64_t fmix64 ( uint64_t k ) +MURMUR3_FORCE_INLINE uint64_t fmix64 ( uint64_t k ) { k ^= k >> 33; - k *= BIG_CONSTANT(0xff51afd7ed558ccd); + k *= MURMUR3_BIG_CONSTANT(0xff51afd7ed558ccd); k ^= k >> 33; - k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53); + k *= MURMUR3_BIG_CONSTANT(0xc4ceb9fe1a85ec53); k ^= k >> 33; return k; } -FORCE_INLINE void MurmurHash3_x64_128(const void* key, int lenBytes, uint64_t seed, HashState& out) { - static const uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5); - static const uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f); +MURMUR3_FORCE_INLINE void MurmurHash3_x64_128(const void* key, int lenBytes, uint64_t seed, HashState& out) { + static const uint64_t c1 = MURMUR3_BIG_CONSTANT(0x87c37b91114253d5); + static const uint64_t c2 = MURMUR3_BIG_CONSTANT(0x4cf5ad432745937f); const uint8_t* data = (const uint8_t*)key; @@ -114,13 +107,13 @@ FORCE_INLINE void MurmurHash3_x64_128(const void* key, int lenBytes, uint64_t se uint64_t k1 = getblock64(blocks,i*2+0); uint64_t k2 = getblock64(blocks,i*2+1); - k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; out.h1 ^= k1; - out.h1 = ROTL64(out.h1,27); + k1 *= c1; k1 = MURMUR3_ROTL64(k1,31); k1 *= c2; out.h1 ^= k1; + out.h1 = MURMUR3_ROTL64(out.h1,27); out.h1 += out.h2; out.h1 = out.h1*5+0x52dce729; - k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; out.h2 ^= k2; - out.h2 = ROTL64(out.h2,31); + k2 *= c2; k2 = MURMUR3_ROTL64(k2,33); k2 *= c1; out.h2 ^= k2; + out.h2 = MURMUR3_ROTL64(out.h2,31); out.h2 += out.h1; out.h2 = out.h2*5+0x38495ab5; } @@ -140,7 +133,7 @@ FORCE_INLINE void MurmurHash3_x64_128(const void* key, int lenBytes, uint64_t se case 11: k2 ^= ((uint64_t)tail[10]) << 16; // falls through case 10: k2 ^= ((uint64_t)tail[ 9]) << 8; // falls through case 9: k2 ^= ((uint64_t)tail[ 8]) << 0; - k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; out.h2 ^= k2; + k2 *= c2; k2 = MURMUR3_ROTL64(k2,33); k2 *= c1; out.h2 ^= k2; // falls through case 8: k1 ^= ((uint64_t)tail[ 7]) << 56; // falls through case 7: k1 ^= ((uint64_t)tail[ 6]) << 48; // falls through @@ -150,7 +143,7 @@ FORCE_INLINE void MurmurHash3_x64_128(const void* key, int lenBytes, uint64_t se case 3: k1 ^= ((uint64_t)tail[ 2]) << 16; // falls through case 2: k1 ^= ((uint64_t)tail[ 1]) << 8; // falls through case 1: k1 ^= ((uint64_t)tail[ 0]) << 0; - k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; out.h1 ^= k1; + k1 *= c1; k1 = MURMUR3_ROTL64(k1,31); k1 *= c2; out.h1 ^= k1; }; //---------- @@ -171,10 +164,14 @@ FORCE_INLINE void MurmurHash3_x64_128(const void* key, int lenBytes, uint64_t se //----------------------------------------------------------------------------- -FORCE_INLINE uint16_t compute_seed_hash(uint64_t seed) { +MURMUR3_FORCE_INLINE uint16_t compute_seed_hash(uint64_t seed) { HashState hashes; MurmurHash3_x64_128(&seed, sizeof(seed), 0, hashes); return static_cast<uint16_t>(hashes.h1 & 0xffff); } +#undef MURMUR3_FORCE_INLINE +#undef MURMUR3_ROTL64 +#undef MURMUR3_BIG_CONSTANT + #endif // _MURMURHASH3_H_
