Try fixing __has_attribute errors on Travis macOS

This commit is contained in:
Mahmoud Al-Qudsi 2019-09-05 23:11:59 -05:00
parent 80610addf8
commit f854e3dc29

View File

@ -66,18 +66,18 @@ char *tparm_solaris_kludge(char *str, long p1 = 0, long p2 = 0, long p3 = 0, lon
long p5 = 0, long p6 = 0, long p7 = 0, long p8 = 0, long p9 = 0);
#endif
/// On OS X, use weak linking for wcsdup and wcscasecmp. Weak linking allows you to call the
/// function only if it exists at runtime. You can detect it by testing the function pointer against
/// NULL. To avoid making the callers do that, redefine wcsdup to wcsdup_use_weak, and likewise with
/// wcscasecmp. This lets us use the same binary on SnowLeopard (10.6) and Lion+ (10.7), even though
/// these functions only exist on 10.7+.
///
/// On other platforms, use what's detected at build time.
// On OS X, use weak linking for wcsdup and wcscasecmp. Weak linking allows you to call the
// function only if it exists at runtime. You can detect it by testing the function pointer against
// NULL. To avoid making the callers do that, redefine wcsdup to wcsdup_use_weak, and likewise with
// wcscasecmp. This lets us use the same binary on SnowLeopard (10.6) and Lion+ (10.7), even though
// these functions only exist on 10.7+.
//
// On other platforms, use what's detected at build time.
#if __APPLE__
#if __DARWIN_C_LEVEL >= 200809L && __has_attribute(clang::weak_import)
// We have to explicitly redeclare these as weak,
// since we are forced to set the MIN_REQUIRED availability macro to 10.7
// to use libc++, which in turn exposes these as strong
// Avoid warnings about unknown `clang::weak_import` attribute (e.g. GCC 8.2.0 on macOS 10.10)
#if __DARWIN_C_LEVEL >= 200809L && __clang__ && __has_attribute(weak_import)
// We have to explicitly redeclare these as weak, since we are forced to set the MIN_REQUIRED
// availability macro to 10.7 to use libc++, which in turn exposes these as strong
[[clang::weak_import]] wchar_t *wcsdup(const wchar_t *);
[[clang::weak_import]] int wcscasecmp(const wchar_t *, const wchar_t *);
[[clang::weak_import]] int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n);
@ -92,8 +92,8 @@ wchar_t *wcsdup(const wchar_t *in);
int wcscasecmp(const wchar_t *a, const wchar_t *b);
int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n);
wchar_t *wcsndup(const wchar_t *in, size_t c);
#endif
#else //__APPLE__
#endif // clang::weak_import
#else // __APPLE__
/// These functions are missing from Solaris 10, and only accessible from
/// Solaris 11 in the std:: namespace.