LibreOffice Module bridges (master)  1
gcc3_linux_intel/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 namespace CPPU_CURRENT_NAMESPACE
64 {
65 
66 void dummy_can_throw_anything( char const * );
67 
68 // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h
69 
70 struct __cxa_exception
71 {
72  std::type_info *exceptionType;
73  void (*exceptionDestructor)(void *);
74 
75  void (*unexpectedHandler)(); // std::unexpected_handler dropped from C++17
76  std::terminate_handler terminateHandler;
77 
78  __cxa_exception *nextException;
79 
80  int handlerCount;
81 
83  const unsigned char *actionRecord;
84  const unsigned char *languageSpecificData;
85  void *catchTemp;
86  void *adjustedPtr;
87 
88  _Unwind_Exception unwindHeader;
89 };
90 
91 struct __cxa_eh_globals
92 {
93  __cxa_exception *caughtExceptions;
94  unsigned int uncaughtExceptions;
95 };
96 
97 }
98 
99 // __cxa_get_globals is exported from libstdc++ since GCC 3.4.0 (CXXABI_1.3),
100 // but it is only declared in cxxabi.h (in namespace __cxxabiv1) since
101 // GCC 4.7.0. It returns a pointer to a struct __cxa_eh_globals, but that
102 // struct is only incompletely declared even in the GCC 4.7.0 cxxabi.h.
103 // Therefore, provide a declaration here for old GCC (libstdc++, really) version
104 // that returns a void pointer, and in the code calling it always cast to the
105 // above fake definition of CPPU_CURRENT_NAMESPACE::__cxa_eh_globals (which
106 // hopefully keeps matching the real definition in libstdc++); similarly for
107 // __cxa_allocate_exception and __cxa_throw, though they do not have the
108 // additional problem of an incompletely declared return type:
109 
110 #if !HAVE_CXXABI_H_CXA_GET_GLOBALS
111 namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); }
112 #endif
113 
114 #if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE
115 namespace __cxxabiv1 {
116 extern "C" std::type_info *__cxa_current_exception_type() throw();
117 }
118 #endif
119 
120 #if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
121 namespace __cxxabiv1 {
122 extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
123 }
124 #endif
125 
126 #if !HAVE_CXXABI_H_CXA_THROW
127 namespace __cxxabiv1 {
128 extern "C" void __cxa_throw(
129  void * thrown_exception, void * tinfo, void (* dest)(void *))
130  __attribute__((noreturn));
131 }
132 #endif
133 
134 extern "C" void privateSnippetExecutorGeneral();
135 extern "C" void privateSnippetExecutorVoid();
136 extern "C" void privateSnippetExecutorHyper();
137 extern "C" void privateSnippetExecutorFloat();
138 extern "C" void privateSnippetExecutorDouble();
139 extern "C" void privateSnippetExecutorClass();
140 
141 namespace CPPU_CURRENT_NAMESPACE
142 {
143 
144 void raiseException(
145  uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
146 
147 void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno);
148 
149 }
150 
151 namespace x86
152 {
153  bool isSimpleReturnType(typelib_TypeDescription * pTD, bool recursive = false);
154 }
155 
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void privateSnippetExecutorGeneral()
void privateSnippetExecutorClass()
__si_class_type_info(char const *n, __class_type_info const *base)
struct _uno_Mapping uno_Mapping
Definition: msvc/except.hxx:32
void privateSnippetExecutorDouble()
void fillUnoException(uno_Any *pExc, uno_Mapping *pCpp2Uno)
sal_Int64 n
std::type_info * __cxa_current_exception_type()
void privateSnippetExecutorHyper()
bool isSimpleReturnType(typelib_TypeDescription *pTD, bool recursive=false)
__class_type_info(const char *__n)
Definition: rtti.h:217
void privateSnippetExecutorVoid()
struct _uno_Any uno_Any
Definition: msvc/except.hxx:31
unsigned _Unwind_Word __attribute__((__mode__(__word__)))
Definition: unwind-cxx.h:45
const __class_type_info * __base_type
Definition: rtti.h:309
void const * base
struct _typelib_TypeDescription typelib_TypeDescription
Definition: msvc/except.hxx:52
void * __cxa_allocate_exception(size_t thrown_size)
void raiseException(uno_Any *pUnoExc, uno_Mapping *pUno2Cpp)
__cxa_eh_globals * __cxa_get_globals()
void dummy_can_throw_anything(char const *)
void privateSnippetExecutorFloat()
void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void(*dest)(void *)) __attribute__((noreturn))
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo