From 6eb88dc13f392967d862f97b11c25fbff5d8c57c Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 8 Jan 2017 01:18:47 -0800 Subject: [PATCH] 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. --- src/fallback.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/fallback.h b/src/fallback.h index f29f2fffb..5a808834a 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -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);