summaryrefslogtreecommitdiffstats
path: root/bridges/inc
diff options
context:
space:
mode:
authorDavid Ostrovsky <david@ostrovsky.org>2015-09-10 23:03:39 +0200
committerDavid Ostrovsky <david@ostrovsky.org>2015-09-12 09:17:15 +0000
commit1aad95eb96bb0e9416a608b8a0416bd7d46b1cab (patch)
tree370117f45196d8a5835dee2079018ca908ca9caa /bridges/inc
parentTypo: muliple->multiple (diff)
downloadcore-1aad95eb96bb0e9416a608b8a0416bd7d46b1cab.tar.gz
core-1aad95eb96bb0e9416a608b8a0416bd7d46b1cab.zip
Actually fix uno bridge on MSVC 14.0
VC runtime was substantially refactored on MSVC 14.0. Among other, _tiddata structure defined in crt/src/mtdll.h was replaced with __vcrt_getptd defined in crt/src/vcruntime/vcruntime_internal.h. All members before unsigned long _NLG_dwCode were removed, so that the approach to access the member void * _tpxcptinfoptrs; /* ptr to exception info pointers */ with __pxcptinfoptrs() and compute the offset to the _curexception member of _tiddata doesn't work on MSVC 14.0. As of MSVC 14.0 __vcrt_getptd symbol isn't exported but Microsoft have introduced methods to access current exception, current exception context and processing throw (the later can be accessed through C++17 std::unhandled_exceptions() that was made available in MSVC 14.0): * __current_exception() * __current_exception_context() * __processing_throw() aka std::unhandled_exceptions() Make use of __current_exception() which we can hope will be maintained going forward. Change-Id: Ibfffa5fba62d6928328ac976cb1b24937277363e Reviewed-on: https://gerrit.libreoffice.org/18475 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Ostrovsky <david@ostrovsky.org>
Diffstat (limited to 'bridges/inc')
-rw-r--r--bridges/inc/bridges/cpp_uno/shared/except.hxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/bridges/inc/bridges/cpp_uno/shared/except.hxx b/bridges/inc/bridges/cpp_uno/shared/except.hxx
new file mode 100644
index 000000000000..fcb455297bf2
--- /dev/null
+++ b/bridges/inc/bridges/cpp_uno/shared/except.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BRIDGES_INC_BRIDGES_CPP_UNO_SHARED_EXCEPT_HXX
+#define INCLUDED_BRIDGES_INC_BRIDGES_CPP_UNO_SHARED_EXCEPT_HXX
+
+#if _MSC_VER >= 1900 // VC 2015 (and later?)
+// extern "C" void** __cdecl __current_exception()
+// is defined in MSVS14.0/VC/crt/src/vcruntime/frame.cpp:
+// return &__vcrt_getptd()->_curexception;
+//
+// __vcrt_getptd is defined in vcruntime_internal.h:
+//typedef struct __vcrt_ptd
+//{
+// // C++ Exception Handling (EH) state
+// unsigned long _NLG_dwCode; // Required by NLG routines
+//[...]
+//void* _curexception; // current exception
+//[...]
+extern "C" void** __current_exception();
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */