From 9984776751a86aa4b1dc52db9611db9a87e92ae7 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 6 Oct 2020 10:55:29 +0200 Subject: [PATCH] Fix build with older clang (e.g. 3.8.1). --- src/include/xxhash.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/include/xxhash.hpp b/src/include/xxhash.hpp index 81e8207468..8543ccc90b 100644 --- a/src/include/xxhash.hpp +++ b/src/include/xxhash.hpp @@ -285,7 +285,7 @@ namespace xxh #else constexpr endianness get_endian(endianness endian) { - constexpr std::array endian_lookup = { endianness::big_endian, endianness::little_endian, (XXH_CPU_LITTLE_ENDIAN) ? endianness::little_endian : endianness::big_endian }; + constexpr std::array endian_lookup = {{ endianness::big_endian, endianness::little_endian, (XXH_CPU_LITTLE_ENDIAN) ? endianness::little_endian : endianness::big_endian }}; return endian_lookup[static_cast(endian)]; } @@ -345,8 +345,8 @@ namespace xxh * Hash functions - Implementation *********************************************************************/ - constexpr static std::array primes32 = { 2654435761U, 2246822519U, 3266489917U, 668265263U, 374761393U }; - constexpr static std::array primes64 = { 11400714785074694791ULL, 14029467366897019727ULL, 1609587929392839161ULL, 9650029242287828579ULL, 2870177450012600261ULL }; + constexpr static std::array primes32 = {{ 2654435761U, 2246822519U, 3266489917U, 668265263U, 374761393U }}; + constexpr static std::array primes64 = {{ 11400714785074694791ULL, 14029467366897019727ULL, 1609587929392839161ULL, 9650029242287828579ULL, 2870177450012600261ULL }}; template constexpr hash_t PRIME(int32_t n) {}; @@ -381,7 +381,13 @@ namespace xxh } template - inline void endian_align_sub_mergeround([[maybe_unused]] hash_t& hash_ret, hash_t v1, hash_t v2, hash_t v3, hash_t v4) {}; + inline void endian_align_sub_mergeround( +#if __cplusplus < 201703L + __attribute__((unused)) +#else + [[maybe_unused]] +#endif + hash_t& hash_ret, hash_t v1, hash_t v2, hash_t v3, hash_t v4) {}; template <> inline void endian_align_sub_mergeround<64>(hash_t<64>& hash_ret, hash_t<64> v1, hash_t<64> v2, hash_t<64> v3, hash_t<64> v4) -- 2.20.1