]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve portability
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 Feb 2017 13:07:43 +0000 (13:07 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 Feb 2017 13:07:43 +0000 (13:07 +0000)
contrib/mumhash/mum.h
contrib/t1ha/t1ha.h

index ae6eec16c1821d90749fb89c4441e8c3aae4c92c..9fab8e7bc6c93356585639046a240fd65ebea3e6 100644 (file)
@@ -62,7 +62,7 @@ typedef unsigned __int64 uint64_t;
 /* In GCC uint128_t is defined if HOST_BITS_PER_WIDE_INT >= 64.
    HOST_WIDE_INT is long if HOST_BITS_PER_LONG > HOST_BITS_PER_INT,
    otherwise int. */
-#if defined(__GNUC__) && UINT_MAX != ULONG_MAX
+#ifdef __SIZEOF_INT128__
 #define _MUM_USE_INT128 1
 #else
 #define _MUM_USE_INT128 0
@@ -73,7 +73,7 @@ typedef unsigned __int64 uint64_t;
 #define _MUM_FRESH_GCC
 #endif
 
-#if defined(__GNUC__) && !defined(__llvm__)
+#if !defined(__llvm__) && defined(_MUM_FRESH_GCC)
 #define _MUM_ATTRIBUTE_UNUSED  __attribute__((unused))
 #define _MUM_OPTIMIZE(opts) __attribute__((__optimize__ (opts)))
 #define _MUM_TARGET(opts) __attribute__((__target__ (opts)))
index 2f6e48e3f869fd6366aea0496335ae0761aabb1a..1ad763c3aa360c70d303757089c58fddea49e708 100644 (file)
 #endif
 #define likely(cond) __builtin_expect(!!(cond), 1)
 #define unlikely(cond) __builtin_expect(!!(cond), 0)
+# if __GNUC_PREREQ(4, 6) || defined(__clang__)
 #define unreachable() __builtin_unreachable()
+# else
+#define unreachable()                                                          \
+               do {                                                                   \
+               for (;;)                                                               \
+               ;                                                                      \
+               } while (0)
+# endif
 #define bswap64(v) __builtin_bswap64(v)
 #define bswap32(v) __builtin_bswap32(v)
 #if __GNUC_PREREQ(4, 8) || __has_builtin(__builtin_bswap16)