]> granicus.if.org Git - php/commitdiff
hash: murmur: Suppress sanitize warnings under GCC
authorAnatol Belski <ab@php.net>
Sun, 1 Nov 2020 20:20:55 +0000 (21:20 +0100)
committerAnatol Belski <ab@php.net>
Sun, 1 Nov 2020 20:22:03 +0000 (21:22 +0100)
Signed-off-by: Anatol Belski <ab@php.net>
ext/hash/murmur/endianness.h

index 23e6fb5a723fa6049d19080c017db98d6272d054..fd971a383ab859dae176ee5a839115f2f6d7e968 100644 (file)
@@ -55,9 +55,13 @@ FORCE_INLINE uint64_t BSWAP64(uint64_t u)
 }
 #endif
 
-#ifdef __clang__
-__attribute__((no_sanitize("alignment")))
+#if defined(__clang__) || defined(__GNUC__) && ( __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+# define NO_SANITIZE_ALIGNMENT __attribute__((no_sanitize("alignment")))
+#else
+# define NO_SANITIZE_ALIGNMENT
 #endif
+
+NO_SANITIZE_ALIGNMENT
 FORCE_INLINE uint32_t getblock32 ( const uint32_t * const p, const int i)
 {
   if (IsBigEndian()) {
@@ -67,9 +71,7 @@ FORCE_INLINE uint32_t getblock32 ( const uint32_t * const p, const int i)
   }
 }
 
-#ifdef __clang__
-__attribute__((no_sanitize("alignment")))
-#endif
+NO_SANITIZE_ALIGNMENT
 FORCE_INLINE uint64_t getblock64 ( const uint64_t * const p, const int i)
 {
   if (IsBigEndian()) {
@@ -78,3 +80,5 @@ FORCE_INLINE uint64_t getblock64 ( const uint64_t * const p, const int i)
     return p[i];
   }
 }
+
+#undef NO_SANITIZE_ALIGNMENT