Bug 1119571 - Update stlport to the latest from Android NDK. r=nfroyd
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 09 Jan 2015 09:05:58 +0900
changeset 236124 7d301619ebacf61442f86c6ac5b3c73abc6fa60b
parent 236123 ac811920efd696a27e80ffd15218794169f91e47
child 236125 87d51f6a3c2985b2b6ed1248aff1f363941fdb97
push id389
push usermartin.thomson@gmail.com
push dateFri, 09 Jan 2015 23:59:51 +0000
reviewersnfroyd
bugs1119571
milestone37.0a1
Bug 1119571 - Update stlport to the latest from Android NDK. r=nfroyd
build/stlport/Android.mk
build/stlport/README.mozilla
build/stlport/stlport/stl/_istream.c
build/stlport/stlport/stl/_slist.c
build/stlport/stlport/stl/_stdexcept_base.c
build/stlport/stlport/stl/_time_facets.c
build/stlport/stlport/stl/config/_android.h
build/stlport/stlport/stl/config/_linux.h
build/stlport/stlport/stl/config/features.h
build/stlport/stlport/stl/config/stl_confix.h
--- a/build/stlport/Android.mk
+++ b/build/stlport/Android.mk
@@ -1,19 +1,19 @@
 LOCAL_PATH := $(call my-dir)
 
 # Normally, we distribute the NDK with prebuilt binaries of STLport
-# in $LOCAL_PATH/<abi>/. However,
+# in $LOCAL_PATH/libs/<abi>/. However,
 #
 
 STLPORT_FORCE_REBUILD := $(strip $(STLPORT_FORCE_REBUILD))
 ifndef STLPORT_FORCE_REBUILD
-  ifeq (,$(strip $(wildcard $(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/libstlport_static.a)))
+  ifeq (,$(strip $(wildcard $(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/libstlport_static$(TARGET_LIB_EXTENSION))))
     $(call __ndk_info,WARNING: Rebuilding STLport libraries from sources!)
-    $(call __ndk_info,You might want to use $$NDK/build/tools/build-stlport.sh)
+    $(call __ndk_info,You might want to use $$NDK/build/tools/build-cxx-stl.sh --stl=stlport)
     $(call __ndk_info,in order to build prebuilt versions to speed up your builds!)
     STLPORT_FORCE_REBUILD := true
   endif
 endif
 
 libstlport_path := $(LOCAL_PATH)
 
 libstlport_src_files := \
@@ -60,31 +60,49 @@ libstlport_c_includes := $(libstlport_pa
 #
 # This simplifies usage, since you only have to list a single library
 # as a dependency, instead of two, especially when using the standalone
 # toolchain.
 #
 include $(dir $(LOCAL_PATH))/gabi++/sources.mk
 
 libstlport_c_includes += $(libgabi++_c_includes)
+ifneq ($(strip $(filter-out $(NDK_KNOWN_ARCHS),$(TARGET_ARCH))),)
+libgabi++_src_files := src/delete.cc \
+                       src/new.cc
+endif
 
 ifneq ($(STLPORT_FORCE_REBUILD),true)
 
 $(call ndk_log,Using prebuilt STLport libraries)
 
 include $(CLEAR_VARS)
 LOCAL_MODULE := stlport_static
-LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).a
+LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
+# For armeabi*, choose thumb mode unless LOCAL_ARM_MODE := arm
+ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI)))
+ifneq (arm,$(LOCAL_ARM_MODE))
+LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/thumb/lib$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
+endif
+endif
 LOCAL_EXPORT_C_INCLUDES := $(libstlport_c_includes)
 LOCAL_CPP_FEATURES := rtti
 include $(PREBUILT_STATIC_LIBRARY)
 
 include $(CLEAR_VARS)
 LOCAL_MODULE := stlport_shared
-LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
+LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE)$(TARGET_SONAME_EXTENSION)
+# For armeabi*, choose thumb mode unless LOCAL_ARM_MODE := arm
+$(info TARGET_ARCH_ABI=$(TARGET_ARCH_ABI))
+$(info LOCAL_ARM_MODE=$(LOCAL_ARM_MODE))
+ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI)))
+ifneq (arm,$(LOCAL_ARM_MODE))
+LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/thumb/lib$(LOCAL_MODULE)$(TARGET_SONAME_EXTENSION)
+endif
+endif
 LOCAL_EXPORT_C_INCLUDES := $(libstlport_c_includes)
 LOCAL_CPP_FEATURES := rtti
 include $(PREBUILT_SHARED_LIBRARY)
 
 else # STLPORT_FORCE_REBUILD == true
 
 $(call ndk_log,Rebuilding STLport libraries from sources)
 
--- a/build/stlport/README.mozilla
+++ b/build/stlport/README.mozilla
@@ -1,9 +1,11 @@
-This copy of STLport was taken from the Android NDK r8e.
-Android specific changes are listed in README.android.
-The libs/ directory containing prebuilt static libraries was removed.
+This copy of STLport was taken from the Android NDK git repository:
+https://android.googlesource.com/platform/ndk.git
+under sources/cxx-stl/stlport/.
+The last changes to that directory come from commit ba4baa4
+
 The overrides/ directory contains Mozilla-specific overrides to the standard
   C++ headers found in the NDK.
 
 The following patches are applied on top:
 - android-mozilla-config.patch: Adjusts Android-specific configuration
   to the mozilla codebase use of the STL.
--- a/build/stlport/stlport/stl/_istream.c
+++ b/build/stlport/stlport/stl/_istream.c
@@ -1140,17 +1140,16 @@ basic_istream<_CharT, _Traits>::ignore(s
 template <class _CharT, class _Traits>
 basic_istream<_CharT, _Traits>&
 basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __delim) {
   sentry __sentry(*this, _No_Skip_WS());
   this->_M_gcount = 0;
 
   if (__sentry) {
     basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf();
-    typedef _STLP_PRIV _Constant_unary_fun<bool, int_type> _Const_bool;
     typedef _STLP_PRIV _Constant_binary_fun<streamsize, streamsize, streamsize>
       _Const_streamsize;
     const streamsize __maxss = (numeric_limits<streamsize>::max)();
 
     if (__n == (numeric_limits<int>::max)()) {
       if (__buf->gptr() != __buf->egptr())
         _M_gcount = _M_ignore_buffered(this,  __buf,
                                        __maxss, _Const_streamsize(__maxss),
--- a/build/stlport/stlport/stl/_slist.c
+++ b/build/stlport/stlport/stl/_slist.c
@@ -143,17 +143,16 @@ void _Slist_unique(slist<_Tp, _Alloc>& _
     }
   }
 }
 
 template <class _Tp, class _Alloc, class _StrictWeakOrdering>
 void _Slist_merge(slist<_Tp, _Alloc>& __that, slist<_Tp, _Alloc>& __x,
                   _StrictWeakOrdering __comp) {
   typedef _Slist_node<_Tp> _Node;
-  typedef _STLP_PRIV _Slist_node_base _Node_base;
   if (__that.get_allocator() == __x.get_allocator()) {
     typename slist<_Tp, _Alloc>::iterator __ite(__that.before_begin());
     while (__ite._M_node->_M_next && !__x.empty()) {
       if (__comp(__x.front(), __STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data)) {
         _STLP_VERBOSE_ASSERT(!__comp(__STATIC_CAST(_Node*, __ite._M_node->_M_next)->_M_data, __x.front()),
                              _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
         __that.splice_after(__ite, __x, __x.before_begin());
       }
--- a/build/stlport/stlport/stl/_stdexcept_base.c
+++ b/build/stlport/stlport/stl/_stdexcept_base.c
@@ -59,17 +59,17 @@
   _M_name[__size - 1] = '\0';
 #else
   strncpy_s(_M_name, __size, __x._M_name, __size - 1);
 #endif
 }
 
 __Named_exception& __Named_exception::operator = (const __Named_exception& __x) {
   size_t __size = strlen(__x._M_name) + 1;
-  size_t __buf_size = _M_name != _M_static_name ? *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) : _S_bufsize;
+  size_t __buf_size = _M_name != _M_static_name ? *(__REINTERPRET_CAST(size_t*, &_M_static_name[0])) : static_cast<size_t>(_S_bufsize);
   if (__size > __buf_size) {
     // Being here necessarily mean that we need to allocate a buffer:
     if (_M_name != _M_static_name) free(_M_name);
     _M_name = __STATIC_CAST(char*, malloc(__size * sizeof(char)));
     if (!_M_name) {
       __size = _S_bufsize;
       _M_name = _M_static_name;
     }
--- a/build/stlport/stlport/stl/_time_facets.c
+++ b/build/stlport/stlport/stl/_time_facets.c
@@ -146,17 +146,16 @@ size_t _STLP_CALL
 // the correct overloading for the calls to __get_integer_nogroup.
 template <class _InIt1, class _Ch, class _TimeInfo>
 string::const_iterator _STLP_CALL
 __get_formatted_time _STLP_WEAK (_InIt1 __first,  _InIt1 __last,
                                  string::const_iterator __format, string::const_iterator __format_end,
                                  _Ch*, const _TimeInfo& __table,
                                  const ios_base& __s, ios_base::iostate& __err, tm* __t) {
   const ctype<_Ch>& __ct = use_facet<ctype<_Ch> >(__s.getloc());
-  typedef basic_string<_Ch, char_traits<_Ch>, allocator<_Ch> > string_type;
   size_t offset;
 
   while (__first != __last && __format != __format_end) {
     offset = 0;
     if (*__format == '%') {
       ++__format;
       char __c = *__format;
       if (__c == '#') { //MS extension
--- a/build/stlport/stlport/stl/config/_android.h
+++ b/build/stlport/stlport/stl/config/_android.h
@@ -47,17 +47,17 @@
 #define _STLP_USE_SIMPLE_NODE_ALLOC 1
 
 // Don't use extern versions of range errors, so we don't need to
 // compile as a library.
 #define _STLP_USE_NO_EXTERN_RANGE_ERRORS 1
 
 // The system math library doesn't have long double variants, e.g
 // sinl, cosl, etc
-#define _STLP_NO_VENDOR_MATH_L 1
+#define _STLP_NO_VENDOR_MATH_L
 
 // Include most of the gcc settings.
 #include <stl/config/_gcc.h>
 
 // Do not use glibc, Android is missing some things.
 #undef _STLP_USE_GLIBC
 
 // No exceptions.
--- a/build/stlport/stlport/stl/config/_linux.h
+++ b/build/stlport/stlport/stl/config/_linux.h
@@ -110,16 +110,17 @@
  *   - ARM
  *   - SH4
  */
 #  if defined(__alpha__) || \
       defined(__ppc__) || defined(PPC) || defined(__powerpc__) || \
       ((defined(__sparc) || defined(__sparcv9) || defined(__sparcv8plus)) && !defined ( __WORD64 ) && !defined(__arch64__)) /* ? */ || \
       (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32)) || \
       defined(__arm__) || \
+      defined(__le32__) || \
       defined(__sh__)
  /* #  if defined(__NO_LONG_DOUBLE_MATH) */
 #    define _STLP_NO_LONG_DOUBLE
 #  endif
 #endif
 
 
 #endif /* __stl_config__linux_h */
--- a/build/stlport/stlport/stl/config/features.h
+++ b/build/stlport/stlport/stl/config/features.h
@@ -303,17 +303,17 @@
 #  undef  _STLP_NO_DEFAULT_NON_TYPE_PARAM
 #  define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1
 #endif
 
 #if !defined (_STLP_STATIC_ASSERT)
 /* Some compiler support 0 size array so we use negative size array to generate
  * a compilation time error.
  */
-#  define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1];
+#  define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1]  __attribute__((unused));
 #endif
 
 /* apple mpw exception handling bug */
 #ifndef _STLP_MPWFIX_TRY
 #  define _STLP_MPWFIX_TRY
 #endif
 #ifndef _STLP_MPWFIX_CATCH
 #  define _STLP_MPWFIX_CATCH
@@ -1047,17 +1047,17 @@ typedef int bool;
 #  include <stl/_abbrevs.h>
 #endif
 
 /* Some really useful macro */
 #define _STLP_ARRAY_SIZE(A) sizeof(A) / sizeof(A[0])
 #define _STLP_ARRAY_AND_SIZE(A) A, sizeof(A) / sizeof(A[0])
 
 #if !defined (_STLP_MARK_PARAMETER_AS_UNUSED)
-#  define _STLP_MARK_PARAMETER_AS_UNUSED(X) (void*)X;
+#  define _STLP_MARK_PARAMETER_AS_UNUSED(X) (void)X;
 #endif
 
 #if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY)
 #  if defined (_STLP_USE_NO_IOSTREAMS)
 #    undef _STLP_CHECK_RUNTIME_COMPATIBILITY
 #  else
 /* The extern "C" simply makes the symbol simpler. */
 #if defined (__cplusplus)
--- a/build/stlport/stlport/stl/config/stl_confix.h
+++ b/build/stlport/stlport/stl/config/stl_confix.h
@@ -75,17 +75,17 @@
 #    define _STLP_HAS_NO_EXCEPTIONS
 #  endif
 #  undef __EDG_SWITCHES
 #endif /* EDG */
 
 /* __EDG_VERSION__ is an official EDG macro, compilers based
  * on EDG have to define it. */
 #if defined (__EDG_VERSION__)
-#  if (__EDG_VERSION__ >= 244) && !defined (_STLP_HAS_INCLUDE_NEXT)
+#  if (__EDG_VERSION__ >= 244) && !defined (_STLP_HAS_INCLUDE_NEXT) && !defined(__ANDROID__)
 #    define _STLP_HAS_INCLUDE_NEXT
 #  endif
 #  if (__EDG_VERSION__ <= 240) && !defined (_STLP_DONT_RETURN_VOID)
 #    define _STLP_DONT_RETURN_VOID
 #  endif
 #  if !defined (__EXCEPTIONS) && !defined (_STLP_HAS_NO_EXCEPTIONS)
 #    define _STLP_HAS_NO_EXCEPTIONS
 #  endif