Fix detection of the __has_attribute() for apple clang [ci skip]

Fixes build on the next osx env:
- Mac OS 10.9/clang 600
- Mac OS 10.8/clang 500

Refs: https://github.com/libevent/libevent/issues/447#issuecomment-497908488
(cherry picked from commit 7d569b0fafe76e9036695ccc9d22d2195c214bce)
This commit is contained in:
Azat Khuzhin 2019-06-02 20:20:02 +03:00 committed by Azat Khuzhin
parent a8a04565b1
commit 7fd7c5eff3
No known key found for this signature in database
GPG Key ID: B86086848EF8686D

View File

@ -52,16 +52,22 @@ extern "C" {
/* __has_attribute() wrapper */
#ifdef __has_attribute
#define EVUTIL_HAS_ATTRIBUTE __has_attribute
# define EVUTIL_HAS_ATTRIBUTE __has_attribute
#endif
/** clang 3 __has_attribute misbehaves in some versions */
#if defined(__clang__) && \
__clang__ == 1 && __clang_major__ == 3 && \
(__clang_minor__ >= 2 && __clang_minor__ <= 5)
#undef EVUTIL_HAS_ATTRIBUTE
#endif
#if defined(__clang__) && __clang__ == 1
# if defined(__apple_build_version__)
# if __clang_major__ <= 6
# undef EVUTIL_HAS_ATTRIBUTE
# endif
# else /* !__apple_build_version__ */
# if __clang_major__ == 3 && __clang_minor__ >= 2 && __clang_minor__ <= 5
# undef EVUTIL_HAS_ATTRIBUTE
# endif
# endif /* __apple_build_version__ */
#endif /*\ defined(__clang__) && __clang__ == 1 */
#ifndef EVUTIL_HAS_ATTRIBUTE
#define EVUTIL_HAS_ATTRIBUTE(x) 0
# define EVUTIL_HAS_ATTRIBUTE(x) 0
#endif
/* If we need magic to say "inline", get it for free internally. */