summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-04-08 12:03:21 -0700
committerDan Albert <danalbert@google.com>2014-04-15 14:59:23 -0700
commit2ef012e47441428f752c6a29d2927513669dda30 (patch)
tree24993a217c7316a03b2f46afd002fa8691d4f21c /src
parent3b74eb32545456120f507d5dc2b74d11a3b89bb0 (diff)
downloadexternal_libcxx-2ef012e47441428f752c6a29d2927513669dda30.tar.gz
external_libcxx-2ef012e47441428f752c6a29d2927513669dda30.tar.bz2
external_libcxx-2ef012e47441428f752c6a29d2927513669dda30.zip
Get libc++ building for Android
This adds an Android makefile, aliases locale aware cctype and cwctype functions, fixes broken configuration in libcxx, and stubs functions missing from bionic. Change-Id: I247372d87caabe0310bedc4540b68ab2ed1986c1
Diffstat (limited to 'src')
-rw-r--r--src/locale.cpp2
-rw-r--r--src/memory.cpp4
-rw-r--r--src/stubs.cpp101
3 files changed, 105 insertions, 2 deletions
diff --git a/src/locale.cpp b/src/locale.cpp
index 4877f2b6a..afc96bd8f 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -30,6 +30,8 @@
#include "__sso_allocator"
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#include <support/win32/locale_win32.h>
+#elif defined(__ANDROID__)
+#include <support/android/langinfo.h>
#else // _LIBCPP_MSVCRT
#include <langinfo.h>
#endif // !_LIBCPP_MSVCRT
diff --git a/src/memory.cpp b/src/memory.cpp
index 666673fc6..02f6bf9dc 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -109,7 +109,7 @@ __shared_weak_count::lock() _NOEXCEPT
return 0;
}
-#ifndef _LIBCPP_NO_RTTI
+#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
const void*
__shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
@@ -117,7 +117,7 @@ __shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
return 0;
}
-#endif // _LIBCPP_NO_RTTI
+#endif // !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
#if __has_feature(cxx_atomic)
diff --git a/src/stubs.cpp b/src/stubs.cpp
new file mode 100644
index 000000000..d8b1ecbcb
--- /dev/null
+++ b/src/stubs.cpp
@@ -0,0 +1,101 @@
+// -*- C++ -*-
+//===----------------------------- stubs.cpp ------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef __ANDROID__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <errno.h>
+#include <wchar.h>
+
+#include <support/android/nl_types.h>
+
+static void unimplemented_stub(const char* function) {
+ const char* fmt = "%s(3) is not implemented on Android\n";
+ fprintf(stderr, fmt, function);
+}
+
+#define UNIMPLEMENTED unimplemented_stub(__PRETTY_FUNCTION__)
+
+float wcstof(const wchar_t *, wchar_t **)
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+double wcstod(const wchar_t *, wchar_t **)
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+long double wcstold(const wchar_t *, wchar_t **)
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+long long wcstoll(const wchar_t *, wchar_t **, int)
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+unsigned long long wcstoull(const wchar_t *, wchar_t **, int)
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+size_t wcsnrtombs(char *, const wchar_t **, size_t, size_t, mbstate_t *)
+{
+ UNIMPLEMENTED;
+ errno = EILSEQ;
+ return (size_t)-1;
+}
+
+size_t mbsnrtowcs(wchar_t *, const char **, size_t, size_t, mbstate_t *)
+{
+ UNIMPLEMENTED;
+ errno = EILSEQ;
+ return (size_t)-1;
+}
+
+int mbtowc(wchar_t *, const char *, size_t)
+{
+ UNIMPLEMENTED;
+ return -1;
+}
+
+nl_catd catopen(const char *, int)
+{
+ UNIMPLEMENTED;
+ return (nl_catd)-1;
+}
+
+int catclose(nl_catd)
+{
+ UNIMPLEMENTED;
+ return -1;
+}
+
+char *catgets(nl_catd, int, int, const char *message)
+{
+ UNIMPLEMENTED;
+ return (char *)message;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __ANDROID__