summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx4
-rw-r--r--cppuhelper/Library_cppuhelper.mk1
-rw-r--r--cppuhelper/source/exc_thrower.cxx57
-rw-r--r--include/ios/ios.hxx19
-rw-r--r--ios/Module_ios.mk1
-rw-r--r--ios/StaticLibrary_ios.mk20
-rw-r--r--ios/source/ios.cxx42
7 files changed, 56 insertions, 88 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
index aaf48deb67ca..d11a11b0c965 100644
--- a/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
@@ -457,10 +457,14 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
void bridges::cpp_uno::shared::VtableFactory::flushCode(
unsigned char const * begin, unsigned char const * end)
{
+#ifndef ANDROID
static void (*clear_cache)(unsigned char const *, unsigned char const *)
= (void (*)(unsigned char const *, unsigned char const *)) dlsym(
RTLD_DEFAULT, "__clear_cache");
(*clear_cache)(begin, end);
+#else
+ __builtin___clear_cache((char*)begin, (char*)end);
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppuhelper/Library_cppuhelper.mk b/cppuhelper/Library_cppuhelper.mk
index 67413f711cd2..5741eea6476f 100644
--- a/cppuhelper/Library_cppuhelper.mk
+++ b/cppuhelper/Library_cppuhelper.mk
@@ -15,6 +15,7 @@ $(eval $(call gb_Library_set_soversion_script,cppuhelper,$(SRCDIR)/cppuhelper/so
$(eval $(call gb_Library_use_internal_comprehensive_api,cppuhelper,\
cppuhelper \
udkapi \
+ offapi \
))
$(eval $(call gb_Library_add_defs,cppuhelper,\
diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx
index 5e029feae982..a0e7fb32b046 100644
--- a/cppuhelper/source/exc_thrower.cxx
+++ b/cppuhelper/source/exc_thrower.cxx
@@ -17,21 +17,22 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <config_features.h>
#include <rtl/instance.hxx>
#include <osl/diagnose.h>
+#include <osl/doublecheckedlocking.h>
+#include <sal/log.hxx>
#include <uno/dispatcher.hxx>
#include <uno/lbnames.h>
#include <uno/mapping.hxx>
#include <cppuhelper/detail/XExceptionThrower.hpp>
+#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
+#include <com/sun/star/ucb/NameClashException.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <cppuhelper/exc_hlp.hxx>
-#ifdef IOS
-#include <ios/ios.hxx>
-#endif
-
using namespace ::osl;
using namespace ::cppu;
using namespace ::com::sun::star;
@@ -172,6 +173,46 @@ ExceptionThrower::ExceptionThrower()
class theExceptionThrower : public rtl::Static<ExceptionThrower, theExceptionThrower> {};
+#if defined(IOS) || HAVE_FEATURE_ANDROID_LOK
+// In the native iOS / Android app, where we don't have any Java, Python,
+// BASIC, or other scripting, the only thing that would use the C++/UNO bridge
+// functionality that invokes codeSnippet() was cppu::throwException().
+//
+// codeSnippet() is part of what corresponds to the code that uses
+// run-time-generated machine code on other platforms. We can't generate code
+// at run-time on iOS, that has been known forever.
+//
+// Instead of digging in and trying to understand what is wrong, another
+// solution was chosen. It turns out that the number of types of exception
+// objects thrown by cppu::throwException() is fairly small. During startup of
+// the LibreOffice code, and loading of an .odt document, only one kind of
+// exception is thrown this way... (The lovely
+// css::ucb:InteractiveAugmentedIOException.)
+//
+// So we can simply have code that checks what the type of object being thrown
+// is, and explicitgly throws such an object then with a normal C++ throw
+// statement. Seems to work.
+template <class E> void tryThrow(css::uno::Any const& aException)
+{
+ E aSpecificException;
+ if (aException >>= aSpecificException)
+ throw aSpecificException;
+}
+
+void lo_mobile_throwException(css::uno::Any const& aException)
+{
+ assert(aException.getValueTypeClass() == css::uno::TypeClass_EXCEPTION);
+
+ tryThrow<css::ucb::InteractiveAugmentedIOException>(aException);
+ tryThrow<css::ucb::NameClashException>(aException);
+ tryThrow<css::uno::RuntimeException>(aException);
+
+ SAL_WARN("cppuhelper", "lo_mobile_throwException: Unhandled exception type: " << aException.getValueTypeName());
+
+ assert(false);
+}
+#endif // defined(IOS) || HAVE_FEATURE_ANDROID_LOK
+
} // anonymous namespace
@@ -188,8 +229,8 @@ void SAL_CALL throwException( Any const & exc )
"(must be derived from com::sun::star::uno::Exception)!" );
}
-#ifdef IOS
- lo_ios_throwException(exc);
+#if defined(IOS) || HAVE_FEATURE_ANDROID_LOK
+ lo_mobile_throwException(exc);
#else
Mapping uno2cpp(Environment(UNO_LB_UNO), Environment::getCurrent());
if (! uno2cpp.is())
@@ -211,6 +252,9 @@ void SAL_CALL throwException( Any const & exc )
Any SAL_CALL getCaughtException()
{
+#if HAVE_FEATURE_ANDROID_LOK
+ return Any();
+#else
Mapping cpp2uno(Environment::getCurrent(), Environment(UNO_LB_UNO));
if (! cpp2uno.is())
{
@@ -258,6 +302,7 @@ Any SAL_CALL getCaughtException()
&ret, exc->pData, exc->pType, uno2cpp.get() );
uno_any_destruct( exc, nullptr );
return ret;
+#endif
}
}
diff --git a/include/ios/ios.hxx b/include/ios/ios.hxx
deleted file mode 100644
index d8fe4d7bd6e1..000000000000
--- a/include/ios/ios.hxx
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_IOS_IOS_HXX
-#define INCLUDED_IOS_IOS_HXX
-
-#include "com/sun/star/uno/Any.hxx"
-
-extern void lo_ios_throwException(css::uno::Any const& aException);
-
-#endif // INCLUDED_IOS_IOS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ios/Module_ios.mk b/ios/Module_ios.mk
index ea9c44644f2c..259c34ba3416 100644
--- a/ios/Module_ios.mk
+++ b/ios/Module_ios.mk
@@ -11,7 +11,6 @@ $(eval $(call gb_Module_Module,ios))
ifeq ($(OS),iOS)
$(eval $(call gb_Module_add_targets,ios,\
- StaticLibrary_ios \
CustomTarget_iOS_setup \
))
diff --git a/ios/StaticLibrary_ios.mk b/ios/StaticLibrary_ios.mk
deleted file mode 100644
index 36baff4e064b..000000000000
--- a/ios/StaticLibrary_ios.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-$(eval $(call gb_StaticLibrary_StaticLibrary,ios))
-
-$(eval $(call gb_StaticLibrary_use_api,ios,\
- udkapi \
- offapi \
-))
-
-$(eval $(call gb_StaticLibrary_add_exception_objects,ios,\
- ios/source/ios \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/ios/source/ios.cxx b/ios/source/ios.cxx
deleted file mode 100644
index bc89150e7ed6..000000000000
--- a/ios/source/ios.cxx
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <cassert>
-#include <iostream>
-
-#include "com/sun/star/uno/Any.hxx"
-#include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp"
-#include "com/sun/star/ucb/NameClashException.hpp"
-#include "ios/ios.hxx"
-
-namespace
-{
-template <class E> void tryThrow(css::uno::Any const& aException)
-{
- E aSpecificException;
- if (aException >>= aSpecificException)
- throw aSpecificException;
-}
-}
-
-void lo_ios_throwException(css::uno::Any const& aException)
-{
- assert(aException.getValueTypeClass() == css::uno::TypeClass_EXCEPTION);
-
- tryThrow<css::ucb::InteractiveAugmentedIOException>(aException);
- tryThrow<css::ucb::NameClashException>(aException);
- tryThrow<css::uno::RuntimeException>(aException);
-
- std::cerr << "lo_ios_throwException: Unhandled exception type " << aException.getValueTypeName()
- << std::endl;
-
- assert(false);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */