diff options
author | Dan Albert <danalbert@google.com> | 2016-06-15 20:20:32 +0000 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2016-06-15 20:20:32 +0000 |
commit | 953d7d44755e9be7ffa4845cdcaf0ced7eec34fa (patch) | |
tree | facac3309fc5776ffa3bb251e679bc81cb235bd0 /libcxx/src/system_error.cpp | |
parent | 98ea88be42b6354db016191149ec58f0f640aa3b (diff) | |
download | bcm5719-llvm-953d7d44755e9be7ffa4845cdcaf0ced7eec34fa.tar.gz bcm5719-llvm-953d7d44755e9be7ffa4845cdcaf0ced7eec34fa.zip |
Add an Android version check for GNU strerror_r.
Summary:
Android didn't gain GNU's strerror_r until Marshmallow. If we're
building libc++ against something older (we build the NDK library
against the oldest release we support, currently Gingerbread), fall
back to the POSIX version.
Reviewers: mclow.lists, EricWF
Subscribers: tberghammer, danalbert, srhines, cfe-commits
Differential Revision: http://reviews.llvm.org/D21402
llvm-svn: 272827
Diffstat (limited to 'libcxx/src/system_error.cpp')
-rw-r--r-- | libcxx/src/system_error.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp index 885afd18ce3..87f35ae37f3 100644 --- a/libcxx/src/system_error.cpp +++ b/libcxx/src/system_error.cpp @@ -21,6 +21,10 @@ #include "string" #include "string.h" +#if defined(__ANDROID__) +#include <android/api-level.h> +#endif + _LIBCPP_BEGIN_NAMESPACE_STD // class error_category @@ -58,7 +62,8 @@ constexpr size_t strerror_buff_size = 1024; string do_strerror_r(int ev); -#if defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC) +#if defined(__linux__) && !defined(_LIBCPP_HAS_MUSL_LIBC) \ + && (!defined(__ANDROID__) || __ANDROID_API__ >= 23) // GNU Extended version string do_strerror_r(int ev) { char buffer[strerror_buff_size]; |