diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-19 10:42:02 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-19 10:42:02 +0000 |
commit | b8588cdab3d7c744f643d13eda1fc652e3bdc5a2 (patch) | |
tree | f91000208b42b422ce04e4fe85d601a32703f6e8 /contrib/t1ha | |
parent | 20457a019f6940fbb6e6a5e89ab23f42b126ad3b (diff) | |
download | rspamd-b8588cdab3d7c744f643d13eda1fc652e3bdc5a2.tar.gz rspamd-b8588cdab3d7c744f643d13eda1fc652e3bdc5a2.zip |
[Minor] Fix build with gcc 4.2
Issue: #1351
Reported by: @brad0
Diffstat (limited to 'contrib/t1ha')
-rw-r--r-- | contrib/t1ha/t1ha.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/contrib/t1ha/t1ha.h b/contrib/t1ha/t1ha.h index 7c97fee90..85deb8971 100644 --- a/contrib/t1ha/t1ha.h +++ b/contrib/t1ha/t1ha.h @@ -88,9 +88,19 @@ #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) @@ -98,7 +108,12 @@ #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) |