summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2022-04-22 07:10:33 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2022-04-22 07:11:59 +0200
commitc3f328ccf69f8a32594d47abc2781041935d5258 (patch)
tree7d6227fc9bb6fdf8730b90967cb78572a6803348
parent48b28c596ddbdd64cda6327a55b38a9dfbbd6492 (diff)
Cherry-pick exc_thrower.cxx changes from c367a2781f99ed22d0f7d64184fb567aacc43f35
This cherry-picks just the changes to `cppuhelper/source/exc_thrower.cxx` to our distro/lhm/libreoffice-7-3+backports branch to simplify backporting of Android-related changes. (The other WASM-related changes are irrelevant since we don't use WASM.) This is a partial cherry-pick of: commit c367a2781f99ed22d0f7d64184fb567aacc43f35 Author: Thorsten Behrens <thorsten.behrens@allotropia.de> Date: Sat Sep 25 18:03:31 2021 +0200 WASM UNO: add a minimal dummy bridge ... and use the same fake exception rethrowing code then the mobile platforms. Change-Id: Ic90de1cfd1e0092d6064d041a613d60d9f5f76b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128596 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> Change-Id: Icfb74267c59437eb6467f2f91a5aa1dada3716d4
-rw-r--r--cppuhelper/source/exc_thrower.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx
index 1bb8bfab13b3..c0d441fcd48b 100644
--- a/cppuhelper/source/exc_thrower.cxx
+++ b/cppuhelper/source/exc_thrower.cxx
@@ -168,9 +168,15 @@ ExceptionThrower::ExceptionThrower()
uno_Interface::pDispatcher = ExceptionThrower_dispatch;
}
+#if defined(IOS) || (defined(__aarch64__) && defined(ANDROID)) || defined(EMSCRIPTEN)
+#define RETHROW_FAKE_EXCEPTIONS 1
+#else
+#define RETHROW_FAKE_EXCEPTIONS 0
+#endif
+
class theExceptionThrower : public rtl::Static<ExceptionThrower, theExceptionThrower> {};
-#if defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
+#if RETHROW_FAKE_EXCEPTIONS
// 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().
@@ -208,7 +214,7 @@ void lo_mobile_throwException(css::uno::Any const& aException)
assert(false);
}
-#endif // defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
+#endif // RETHROW_FAKE_EXCEPTIONS
} // anonymous namespace
@@ -226,7 +232,7 @@ void SAL_CALL throwException( Any const & exc )
"(must be derived from com::sun::star::uno::Exception)!" );
}
-#if defined(IOS) || (defined(__aarch64__) && defined(ANDROID))
+#if RETHROW_FAKE_EXCEPTIONS
lo_mobile_throwException(exc);
#else
Mapping uno2cpp(Environment(UNO_LB_UNO), Environment::getCurrent());
@@ -243,13 +249,14 @@ void SAL_CALL throwException( Any const & exc )
ExceptionThrower::getCppuType() );
OSL_ASSERT( xThrower.is() );
xThrower->throwException( exc );
-#endif
+#endif // !RETHROW_FAKE_EXCEPTIONS
}
Any SAL_CALL getCaughtException()
{
-#if defined(__aarch64__) && defined(ANDROID)
+ // why does this differ from RETHROW_FAKE_EXCEPTIONS?
+#if (defined(__aarch64__) && defined(ANDROID)) || defined(EMSCRIPTEN)
// FIXME This stuff works on 32bit ARM, let's use the shortcut only for
// the 64bit ARM.
return Any();