]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix build with gcc 4.2
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 19 Jan 2017 10:42:02 +0000 (10:42 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 19 Jan 2017 10:42:02 +0000 (10:42 +0000)
Issue: #1351
Reported by: @brad0

contrib/t1ha/t1ha.h

index 7c97fee9059fd3d2879b9a49114c9952ecdb95e6..85deb89711911fb4b71bccbd1978e5cb7f425e2b 100644 (file)
 #endif
 #endif
 
-#if defined(__GNUC__) && (__GNUC__ > 3)
+#ifndef __GNUC_PREREQ
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#define __GNUC_PREREQ(maj, min)                                                \
+  ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#else
+#define __GNUC_PREREQ(maj, min) 0
+#endif
+#endif
+
 
-#if defined(__i386) || defined(__x86_64)
+#if __GNUC_PREREQ(4, 4) || defined(__clang__)
+
+#if defined(__i386__) || defined(__x86_64__)
 #include <x86intrin.h>
 #endif
 #define likely(cond) __builtin_expect(!!(cond), 1)
 #define unreachable() __builtin_unreachable()
 #define bswap64(v) __builtin_bswap64(v)
 #define bswap32(v) __builtin_bswap32(v)
+#if __GNUC_PREREQ(4, 8) || __has_builtin(__builtin_bswap16)
 #define bswap16(v) __builtin_bswap16(v)
+#endif
+#if __GNUC_PREREQ(4, 3) || __has_attribute(unused)
+#define maybe_unused __attribute__((unused))
+#endif
 
 #elif defined(_MSC_VER)