[PATCH] D21402: Add an Android version check for GNU strerror_r.

Dan Albert via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 13:14:46 PDT 2016


danalbert created this revision.
danalbert added reviewers: mclow.lists, EricWF.
danalbert added a subscriber: cfe-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

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.

http://reviews.llvm.org/D21402

Files:
  src/system_error.cpp

Index: src/system_error.cpp
===================================================================
--- src/system_error.cpp
+++ 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 @@
 
 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];


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21402.60887.patch
Type: text/x-patch
Size: 677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160615/70e40e3d/attachment.bin>


More information about the cfe-commits mailing list