Redeclare certain wcs functions as weak on macOS

In order to use C++11 with the standard macOS Xcode toolset,
we must use libc++. This in turn requires using 10.7 as our
MIN_REQUIRED in the availability macros, which in turn marks
certain wide-character functions as strong symbols (since they
were introduced in 10.7).

Redeclare them as weak, so that we can run on 10.6 without link
errors. See #3138 for more.
This commit is contained in:
ridiculousfish 2017-01-08 01:18:47 -08:00
parent 48392517d4
commit 6eb88dc13f

View file

@ -63,6 +63,12 @@ char *tparm_solaris_kludge(char *str, ...);
/// On other platforms, use what's detected at build time.
#if __APPLE__
#if __DARWIN_C_LEVEL >= 200809L
// 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
wchar_t *wcsdup(const wchar_t *) __attribute__((weak_import));
int wcscasecmp(const wchar_t *, const wchar_t *) __attribute__((weak_import));
int wcsncasecmp(const wchar_t *, const wchar_t *, size_t n) __attribute__((weak_import));
wchar_t *wcsdup_use_weak(const wchar_t *);
int wcscasecmp_use_weak(const wchar_t *, const wchar_t *);
int wcsncasecmp_use_weak(const wchar_t *s1, const wchar_t *s2, size_t n);