summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2018-09-12 22:06:18 +0300
committerMichael Meeks <michael.meeks@collabora.com>2018-10-30 17:00:45 +0000
commit1ba33db69fa72c79b806e2d418d91ce1ae7612b9 (patch)
tree68455a2ca3e31a8f205bf5a4cef58c31ce47ceb1 /bridges
parent3f133f7cf7720033e386c464d4d5366a1003ea36 (diff)
Re-think cppu::throwException() and the C++/UNO bridge on iOS
It seems that on iOS, 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 we have used some manually written assembler to handle it instead. We used to have a Perl script to generate a set of code snippets for different cases, different numbers of parameters of the called function and whatnot, but that went away at some stage some year ago. (It is unclear whether that broke the C++/UNO bridge on iOS, or whether the stuff continued to work even after that.) Anyway, this handwritten assembly, or the manual construction of internal data structures for exceptions, or something else, seemed to have bit-rotten. Exceptions thrown with cppu::throwException() were not catchable properly any longer. Instead of digging in and trying to understand what is wrong, I chose another solution. 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. Sadly the cppu::getCaughtException() API still needs some inline assembly in the C++/UNO brige. That seems to work though, knock on wood. This commit also adds a small "unit test" for iOS, copied from cppuhelperm to ImplSVMain(). Ideally we should not copy code around of course, but have a separate unit test app for iOS that would somehow include relevant unit tests from source files all over the place. Later. Change-Id: Ib6d9d5b6fb8cc684ec15c97a312ca2f720e87069 Reviewed-on: https://gerrit.libreoffice.org/60506 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com> (cherry picked from commit 7d6be61a62ca3724c67ab3fb93e60a2748d8a67e) Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
index 762dbdc8db76..595d0e06cee3 100644
--- a/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios/cpp2uno.cxx
@@ -455,6 +455,10 @@ namespace
sal_Int32 functionIndex,
sal_Int32 vtableOffset)
{
+ // For now temporarily assert when we get here. The intent is
+ // that we won't need the code snippets at all on iOS.
+ assert(false);
+
assert(functionIndex < nFunIndexes);
if (!(functionIndex < nFunIndexes))
return NULL;