diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2017-11-22 23:08:06 +0100 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2018-01-18 14:44:25 +0100 |
commit | 4082a18406c18af7b4fcef7bd501c3679c3be56b (patch) | |
tree | 761952db6eea1fc3fab672a8d739562eaf1fb031 /bridges | |
parent | 0e8d0fe001ceecea95ad7115b835527e13252a17 (diff) |
android: use unified headers and llvm-c++ STL (x86) with NDK 16
gnustl (and others) are to be removed in future versions of the ndk
also bump gradle and build-tools to current versions along with it
arm unfortunately crashes with llvm-c++, so keep with gnustl for now/fix
that later
Change-Id: Ic794c3293b599b77ec48096bf3283a99c09cbb79
Reviewed-on: https://gerrit.libreoffice.org/45163
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/Library_cpp_uno.mk | 1 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_arm/except.cxx | 4 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_arm/share.hxx | 53 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx | 7 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_intel/except.cxx | 6 |
5 files changed, 55 insertions, 16 deletions
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk index 22ce084178b6..b64b97e6f22b 100644 --- a/bridges/Library_cpp_uno.mk +++ b/bridges/Library_cpp_uno.mk @@ -199,6 +199,7 @@ endif # it off. ifeq ($(COM),GCC) $(eval $(call gb_Library_add_cxxflags,gcc3_uno,\ + $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-I$(ANDROID_BINUTILS_PREBUILT_ROOT)/lib/gcc/arm-linux-androideabi/4.9.x/include) \ -fno-omit-frame-pointer \ -fno-strict-aliasing \ $(if $(filter TRUE,$(ENABLE_LTO)),-fno-lto) \ diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx index 43e255c21cf6..b4a5117b81c0 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx @@ -309,7 +309,7 @@ namespace CPPU_CURRENT_NAMESPACE return; } - typelib_TypeDescription * pExcTypeDescr = 0; + typelib_TypeDescription * pExcTypeDescr = nullptr; OUString unoName( toUNOname( header->exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); @@ -318,7 +318,7 @@ namespace CPPU_CURRENT_NAMESPACE typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); if (0 == pExcTypeDescr) { - RuntimeException aRE( OUString("exception type not found: ") + unoName ); + RuntimeException aRE( "exception type not found: " + unoName ); Type const & rType = cppu::UnoType<decltype(aRE)>::get(); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); SAL_WARN("bridges", aRE.Message); diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx index 7fddd841498b..62e0feece40b 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx @@ -23,11 +23,7 @@ #include <typeinfo> #include <exception> #include <cstddef> -#ifndef ANDROID #include <unwind.h> -#else -#include <unwind-arm.h> -#endif #include <cxxabi.h> #ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h @@ -37,13 +33,35 @@ #include "config_cxxabi.h" #include "uno/mapping.h" -namespace CPPU_CURRENT_NAMESPACE -{ - - void dummy_can_throw_anything( char const * ); +#if !HAVE_CXXABI_H_CLASS_TYPE_INFO +// <https://mentorembedded.github.io/cxx-abi/abi.html>, +// libstdc++-v3/libsupc++/cxxabi.h: +namespace __cxxabiv1 { +class __class_type_info: public std::type_info { +public: + explicit __class_type_info(char const * n): type_info(n) {} + ~__class_type_info() override; +}; +} +#endif - // -- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h +#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO +// <https://mentorembedded.github.io/cxx-abi/abi.html>, +// libstdc++-v3/libsupc++/cxxabi.h: +namespace __cxxabiv1 { +class __si_class_type_info: public __class_type_info { +public: + __class_type_info const * __base_type; + explicit __si_class_type_info( + char const * n, __class_type_info const *base): + __class_type_info(n), __base_type(base) {} + ~__si_class_type_info() override; +}; +} +#endif +#if !HAVE_CXXABI_H_CXA_EH_GLOBALS +namespace __cxxabiv1 { struct __cxa_exception { std::type_info *exceptionType; @@ -68,12 +86,26 @@ namespace CPPU_CURRENT_NAMESPACE _Unwind_Exception unwindHeader; }; +} +#endif + +namespace CPPU_CURRENT_NAMESPACE +{ + + void dummy_can_throw_anything( char const * ); + + // -- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h + extern "C" void *__cxa_allocate_exception( std::size_t thrown_size ) throw(); extern "C" void __cxa_throw ( void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn)); +} + +#if !HAVE_CXXABI_H_CXA_EH_GLOBALS +namespace __cxxabiv1 { struct __cxa_eh_globals { __cxa_exception *caughtExceptions; @@ -83,6 +115,7 @@ namespace CPPU_CURRENT_NAMESPACE #endif }; } +#endif #if !HAVE_CXXABI_H_CXA_GET_GLOBALS namespace __cxxabiv1 { @@ -95,7 +128,7 @@ namespace CPPU_CURRENT_NAMESPACE void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); void fillUnoException( - __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); + __cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); } extern "C" void privateSnippetExecutor(); diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx index 0f464e1ea6be..3fc2602a602b 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx @@ -571,10 +571,9 @@ static void cpp_call( catch (...) { // fill uno exception - fillUnoException( - reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >( - __cxxabiv1::__cxa_get_globals())->caughtExceptions, - *ppUnoExc, pThis->getBridge()->getCpp2Uno()); + CPPU_CURRENT_NAMESPACE::fillUnoException( + __cxxabiv1::__cxa_get_globals()->caughtExceptions, + *ppUnoExc, pThis->getBridge()->getCpp2Uno()); // temporary params for ( ; nTempIndices--; ) diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx index 8e9ed1e0d868..b06bd4b28f35 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx @@ -156,6 +156,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) #if OSL_DEBUG_LEVEL > 1 fprintf( stderr,"generated rtti for %s\n", rttiName ); #endif +// TODO: incompatible with llvm-c++ in ndk16 - no __si_class_type_info or __class_type_info +// either do as iOS one and inline thing or find another way +#if !defined(ANDROID) if (pTypeDescr->pBaseTypeDescription) { // ensure availability of base @@ -173,6 +176,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); SAL_WARN_IF( !insertion.second, "bridges", "### inserting new generated rtti failed?!" ); +#endif } else // taking already generated rtti { @@ -247,7 +251,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = s_rtti->getRTTI(reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr)); TYPELIB_DANGER_RELEASE( pTypeDescr ); +#if !defined(ANDROID) // see TODO above assert(rtti && "### no rtti for throwing exception!"); +#endif if (! rtti) { throw RuntimeException( |