LibreOffice Module bridges (master) 1
gcc3_macosx_x86-64/share.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#pragma once
20
21#include <uno/mapping.h>
22
23#include <typeinfo>
24#include <exception>
25#include <cstddef>
26
28{
29
30// From opensource.apple.com: libunwind-35.1/include/unwind.h
31
32typedef enum {
43
44struct _Unwind_Exception
45{
48 uintptr_t private_1; // non-zero means forced unwind
49 uintptr_t private_2; // holds sp that phase1 found for phase2 to use
50#if !__LP64__
51 // The gcc implementation of _Unwind_Exception used attribute mode on the above fields
52 // which had the side effect of causing this whole struct to round up to 32 bytes in size.
53 // To be more explicit, we add pad fields added for binary compatibility.
54 uint32_t reserved[3];
55#endif
56};
57
58
59// From libcppabi-24.2/include/unwind-cxx.h
60
61typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
62
63// A C++ exception object consists of a header, which is a wrapper around
64// an unwind object header with additional C++ specific information,
65// followed by the exception object itself.
66
67struct __cxa_exception
68{
69#if __LP64__
70#if 0
71 // This is a new field added with LLVM 10
72 // <https://github.com/llvm/llvm-project/commit/674ec1eb16678b8addc02a4b0534ab383d22fa77>
73 // "[libcxxabi] Insert padding in __cxa_exception struct for compatibility". The HACK in
74 // fillUnoException (bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx) tries to find out at
75 // runtime whether a __cxa_exception has this member. Once we can be sure that we only run
76 // against new libcxxabi that has this member, we can drop the "#if 0" here and drop the hack
77 // in fillUnoException.
78
79 // Now _Unwind_Exception is marked with __attribute__((aligned)),
80 // which implies __cxa_exception is also aligned. Insert padding
81 // in the beginning of the struct, rather than before unwindHeader.
82 void *reserve;
83#endif
84
85 // This is a new field to support C++ 0x exception_ptr.
86 // For binary compatibility it is at the start of this
87 // struct which is prepended to the object thrown in
88 // __cxa_allocate_exception.
89 size_t referenceCount;
90#endif
91 // Manage the exception object itself.
92 std::type_info *exceptionType;
93 void (*exceptionDestructor)(void *);
94
95 // The C++ standard has entertaining rules wrt calling set_terminate
96 // and set_unexpected in the middle of the exception cleanup process.
97 void (*unexpectedHandler)(); // std::unexpected_handler dropped from C++17
98 std::terminate_handler terminateHandler;
99
100 // The caught exception stack threads through here.
102
103 // How many nested handlers have caught this exception. A negated
104 // value is a signal that this object has been rethrown.
105 int handlerCount;
106
107#ifdef __ARM_EABI_UNWINDER__
108 // Stack of exceptions in cleanups.
109 __cxa_exception* nextPropagatingException;
110
111 // The number of active cleanup handlers for this exception.
112 int propagationCount;
113#else
114 // Cache parsed handler data from the personality routine Phase 1
115 // for Phase 2 and __cxa_call_unexpected.
117 const unsigned char *actionRecord;
118 const unsigned char *languageSpecificData;
119 _Unwind_Ptr catchTemp;
120 void *adjustedPtr;
121#endif
122#if !__LP64__
123 // This is a new field to support C++ 0x exception_ptr.
124 // For binary compatibility it is placed where the compiler
125 // previously adding padded to 64-bit align unwindHeader.
127#endif
128
129 // The generic exception header. Must be last.
131};
132
133// Each thread in a C++ program has access to a __cxa_eh_globals object.
134struct __cxa_eh_globals
135{
137 unsigned int uncaughtExceptions;
138#ifdef __ARM_EABI_UNWINDER__
139 __cxa_exception* propagatingExceptions;
140#endif
141};
142
143}
144
146
148{
149
150void raiseException(
151 uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
152
153void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno);
154}
155
156/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * __cxa_get_globals() noexcept
struct _uno_Mapping uno_Mapping
Definition: msvc/except.hxx:33
struct _uno_Any uno_Any
Definition: msvc/except.hxx:32
unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)))
void fillUnoException(uno_Any *pUnoExc, uno_Mapping *pCpp2Uno)