LibreOffice Module bridges (master) 1
gcc3_linux_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
20#include <sal/config.h>
21
22#include <typeinfo>
23#include <exception>
24#include <cstddef>
25
26#include <cxxabi.h>
27#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
28#define _GLIBCXX_CDTOR_CALLABI
29#endif
30#include <unwind.h>
31
32#include <config_cxxabi.h>
33#include <uno/any2.h>
34#include <uno/mapping.h>
35
36#if !HAVE_CXXABI_H_CLASS_TYPE_INFO
37// <https://mentorembedded.github.io/cxx-abi/abi.html>,
38// libstdc++-v3/libsupc++/cxxabi.h:
39namespace __cxxabiv1 {
40class __class_type_info: public std::type_info {
41public:
42 explicit __class_type_info(char const * n): type_info(n) {}
44};
45}
46#endif
47
48#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO
49// <https://mentorembedded.github.io/cxx-abi/abi.html>,
50// libstdc++-v3/libsupc++/cxxabi.h:
51namespace __cxxabiv1 {
52class __si_class_type_info: public __class_type_info {
53public:
56 char const * n, __class_type_info const *base):
59};
60}
61#endif
62
63#if !HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO
64// <https://mentorembedded.github.io/cxx-abi/abi.html>,
65// libstdc++-v3/libsupc++/cxxabi.h:
66namespace __cxxabiv1 {
67struct __base_class_type_info {
69#if defined _GLIBCXX_LLP64
70 long long __offset_flags;
71#else
72 long __offset_flags;
73#endif
75 __virtual_mask = 0x1,
76 __public_mask = 0x2,
78 };
79};
80}
81#endif
82
83#if !HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO
84// <https://mentorembedded.github.io/cxx-abi/abi.html>,
85// libstdc++-v3/libsupc++/cxxabi.h:
86namespace __cxxabiv1 {
87class __vmi_class_type_info: public __class_type_info {
88public:
89 unsigned int __flags;
90 unsigned int __base_count;
91 __base_class_type_info __base_info[1];
96 };
97 explicit __vmi_class_type_info(char const * n, int flags):
100};
101}
102#endif
103
104#if !HAVE_CXXABI_H_CXA_EXCEPTION
105// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>,
106// libcxxabi/src/cxa_exception.hpp:
107namespace __cxxabiv1 {
108struct __cxa_exception {
109#if defined _LIBCPPABI_VERSION // detect libc++abi
110#if defined __LP64__ || LIBCXXABI_ARM_EHABI
111#if 0
112 // This is a new field added with LLVM 10
113 // <https://github.com/llvm/llvm-project/commit/674ec1eb16678b8addc02a4b0534ab383d22fa77>
114 // "[libcxxabi] Insert padding in __cxa_exception struct for compatibility". The HACK in
115 // fillUnoException (bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx) tries to find out at
116 // runtime whether a __cxa_exception has this member. Once we can be sure that we only run
117 // against new libcxxabi that has this member, we can drop the "#if 0" here and drop the hack
118 // in fillUnoException.
119
120 // Now _Unwind_Exception is marked with __attribute__((aligned)),
121 // which implies __cxa_exception is also aligned. Insert padding
122 // in the beginning of the struct, rather than before unwindHeader.
123 void *reserve;
124#endif
125 std::size_t referenceCount;
126#endif
127#endif
128 std::type_info * exceptionType;
129 void (* exceptionDestructor)(void *);
130 void (*unexpectedHandler)(); // std::unexpected_handler dropped from C++17
131 std::terminate_handler terminateHandler;
132 __cxa_exception * nextException;
133 int handlerCount;
135 char const * actionRecord;
136 char const * languageSpecificData;
137 void * catchTemp;
138 void * adjustedPtr;
139 _Unwind_Exception unwindHeader;
140};
141}
142#endif
143
144#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
145// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>:
146namespace __cxxabiv1 {
147struct __cxa_eh_globals {
148 __cxa_exception * caughtExceptions;
149 unsigned int uncaughtExceptions;
150};
151}
152#endif
153
154#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
155namespace __cxxabiv1 {
156extern "C" __cxa_eh_globals * __cxa_get_globals() noexcept;
157}
158#endif
159
160#if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE
161namespace __cxxabiv1 {
162extern "C" std::type_info *__cxa_current_exception_type() noexcept;
163}
164#endif
165
166#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
167namespace __cxxabiv1 {
168extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) noexcept;
169}
170#endif
171
172#if !HAVE_CXXABI_H_CXA_THROW
173namespace __cxxabiv1 {
174extern "C" void __cxa_throw(
175 void * thrown_exception, void * tinfo, void (* dest)(void *))
176 __attribute__((noreturn));
177}
178#endif
179
180extern "C" void privateSnippetExecutor( ... );
181
183{
184
185void raiseException(
186 uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
187
188void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno);
189}
190
191/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
__class_type_info(const char *__n)
Definition: rtti.h:217
const __class_type_info * __base_type
Definition: rtti.h:309
__si_class_type_info(char const *n, __class_type_info const *base)
__vmi_class_type_info(char const *n, int flags)
__base_class_type_info __base_info[1]
Definition: rtti.h:351
void const * base
void privateSnippetExecutor(...)
sal_Int64 n
struct _uno_Mapping uno_Mapping
Definition: msvc/except.hxx:33
struct _uno_Any uno_Any
Definition: msvc/except.hxx:32
void fillUnoException(uno_Any *pUnoExc, uno_Mapping *pCpp2Uno)
void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void(*dest)(void *)) __attribute__((noreturn))
__cxa_eh_globals * __cxa_get_globals()
void * __cxa_allocate_exception(size_t thrown_size)
std::type_info * __cxa_current_exception_type()
unsigned int uncaughtExceptions
Definition: unwind-cxx.h:133
__cxa_exception * caughtExceptions
Definition: unwind-cxx.h:132
const unsigned char * languageSpecificData
Definition: unwind-cxx.h:114
void(* exceptionDestructor)(void *)
Definition: unwind-cxx.h:89
__cxa_exception * nextException
Definition: unwind-cxx.h:97
const unsigned char * actionRecord
Definition: unwind-cxx.h:113
std::terminate_handler terminateHandler
Definition: unwind-cxx.h:94
std::type_info * exceptionType
Definition: unwind-cxx.h:88
_Unwind_Exception unwindHeader
Definition: unwind-cxx.h:126
unsigned _Unwind_Word __attribute__((__mode__(__word__)))
Definition: unwind-cxx.h:45