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:
39 namespace __cxxabiv1 {
40 class __class_type_info: public std::type_info {
41 public:
42  explicit __class_type_info(char const * n): type_info(n) {}
43  ~__class_type_info() override;
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:
51 namespace __cxxabiv1 {
52 class __si_class_type_info: public __class_type_info {
53 public:
56  char const * n, __class_type_info const *base):
57  __class_type_info(n), __base_type(base) {}
58  ~__si_class_type_info() override;
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:
66 namespace __cxxabiv1 {
67 struct __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,
77  __offset_shift = 8
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:
86 namespace __cxxabiv1 {
87 class __vmi_class_type_info: public __class_type_info {
88 public:
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):
98  __class_type_info(n), __flags(flags), __base_count(0) {}
99  ~__vmi_class_type_info() override;
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:
107 namespace __cxxabiv1 {
108 struct __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;
134  int handlerSwitchValue;
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>:
146 namespace __cxxabiv1 {
147 struct __cxa_eh_globals {
148  __cxa_exception * caughtExceptions;
149  unsigned int uncaughtExceptions;
150 };
151 }
152 #endif
153 
154 #if !HAVE_CXXABI_H_CXA_GET_GLOBALS
155 namespace __cxxabiv1 {
156 extern "C" __cxa_eh_globals * __cxa_get_globals() throw();
157 }
158 #endif
159 
160 #if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE
161 namespace __cxxabiv1 {
162 extern "C" std::type_info *__cxa_current_exception_type() throw();
163 }
164 #endif
165 
166 #if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
167 namespace __cxxabiv1 {
168 extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
169 }
170 #endif
171 
172 #if !HAVE_CXXABI_H_CXA_THROW
173 namespace __cxxabiv1 {
174 extern "C" void __cxa_throw(
175  void * thrown_exception, void * tinfo, void (* dest)(void *))
176  __attribute__((noreturn));
177 }
178 #endif
179 
180 extern "C" void privateSnippetExecutor( ... );
181 
182 namespace CPPU_CURRENT_NAMESPACE
183 {
184 
185 void raiseException(
186  uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
187 
188 void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno);
189 }
190 
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
__si_class_type_info(char const *n, __class_type_info const *base)
struct _uno_Mapping uno_Mapping
Definition: msvc/except.hxx:32
void fillUnoException(uno_Any *pExc, uno_Mapping *pCpp2Uno)
sal_Int64 n
_Unwind_Exception unwindHeader
Definition: unwind-cxx.h:124
std::type_info * __cxa_current_exception_type()
__class_type_info(const char *__n)
Definition: rtti.h:217
struct _uno_Any uno_Any
Definition: msvc/except.hxx:31
unsigned int uncaughtExceptions
Definition: unwind-cxx.h:131
__vmi_class_type_info(char const *n, int flags)
unsigned _Unwind_Word __attribute__((__mode__(__word__)))
Definition: unwind-cxx.h:45
const __class_type_info * __base_type
Definition: rtti.h:309
__base_class_type_info __base_info[1]
Definition: rtti.h:351
void const * base
const unsigned char * languageSpecificData
Definition: unwind-cxx.h:112
void privateSnippetExecutor(...)
void * __cxa_allocate_exception(size_t thrown_size)
void raiseException(uno_Any *pUnoExc, uno_Mapping *pUno2Cpp)
__cxa_eh_globals * __cxa_get_globals()
void(* exceptionDestructor)(void *)
Definition: unwind-cxx.h:87
std::type_info * exceptionType
Definition: unwind-cxx.h:86
const unsigned char * actionRecord
Definition: unwind-cxx.h:111
std::terminate_handler terminateHandler
Definition: unwind-cxx.h:92
__cxa_exception * caughtExceptions
Definition: unwind-cxx.h:130
void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void(*dest)(void *)) __attribute__((noreturn))
__cxa_exception * nextException
Definition: unwind-cxx.h:95
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo