tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / bridges / source / cpp_uno / gcc3_linux_aarch64 / abi.hxx
blob10495582dcc036aef71949d3ff2c9f7e044bed18
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <sal/config.h>
24 #include <cstddef>
25 #include <exception>
26 #include <typeinfo>
28 #include <cxxabi.h>
29 #ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
30 #define _GLIBCXX_CDTOR_CALLABI
31 #endif
32 #include <unwind.h>
34 #include <config_cxxabi.h>
35 #include <typelib/typedescription.h>
36 #include <uno/any2.h>
37 #include <uno/mapping.h>
39 #if !HAVE_CXXABI_H_CLASS_TYPE_INFO
40 // <https://mentorembedded.github.io/cxx-abi/abi.html>,
41 // libstdc++-v3/libsupc++/cxxabi.h:
42 namespace __cxxabiv1 {
43 class __class_type_info: public std::type_info {
44 public:
45 explicit __class_type_info(char const * n): type_info(n) {}
46 ~__class_type_info() override;
49 #endif
51 #if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO
52 // <https://mentorembedded.github.io/cxx-abi/abi.html>,
53 // libstdc++-v3/libsupc++/cxxabi.h:
54 namespace __cxxabiv1 {
55 class __si_class_type_info: public __class_type_info {
56 public:
57 __class_type_info const * __base_type;
58 explicit __si_class_type_info(
59 char const * n, __class_type_info const *base):
60 __class_type_info(n), __base_type(base) {}
61 ~__si_class_type_info() override;
64 #endif
66 #if !HAVE_CXXABI_H_CXA_EXCEPTION
67 // <https://mentorembedded.github.io/cxx-abi/abi-eh.html>,
68 // libcxxabi/src/cxa_exception.hpp:
69 namespace __cxxabiv1 {
70 struct __cxa_exception {
71 #if defined _LIBCPPABI_VERSION // detect libc++abi
72 #if defined __LP64__ || LIBCXXABI_ARM_EHABI
73 #ifdef MACOSX // on arm64
74 // This is a new field added with LLVM 10
75 // <https://github.com/llvm/llvm-project/commit/674ec1eb16678b8addc02a4b0534ab383d22fa77>
76 // "[libcxxabi] Insert padding in __cxa_exception struct for compatibility". For non-MACOSX,
77 // the HACK in call (bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx) tries to find out at
78 // runtime whether a __cxa_exception has this member. Once we can be sure that we only run
79 // against new libcxxabi that has this member, we can drop the "#ifdef MACOSX" here and drop the
80 // hack in call.
82 // Now _Unwind_Exception is marked with __attribute__((aligned)),
83 // which implies __cxa_exception is also aligned. Insert padding
84 // in the beginning of the struct, rather than before unwindHeader.
85 void *reserve;
86 #endif
87 std::size_t referenceCount;
88 #endif
89 #endif
90 std::type_info * exceptionType;
91 void (* exceptionDestructor)(void *);
92 void (*unexpectedHandler)(); // std::unexpected_handler dropped from C++17
93 std::terminate_handler terminateHandler;
94 __cxa_exception * nextException;
95 int handlerCount;
96 int handlerSwitchValue;
97 char const * actionRecord;
98 char const * languageSpecificData;
99 void * catchTemp;
100 void * adjustedPtr;
101 _Unwind_Exception unwindHeader;
104 #endif
106 #if !HAVE_CXXABI_H_CXA_EH_GLOBALS
107 // <https://mentorembedded.github.io/cxx-abi/abi-eh.html>:
108 namespace __cxxabiv1 {
109 struct __cxa_eh_globals {
110 __cxa_exception * caughtExceptions;
111 unsigned int uncaughtExceptions;
114 #endif
116 #if !HAVE_CXXABI_H_CXA_GET_GLOBALS
117 namespace __cxxabiv1 {
118 extern "C" __cxa_eh_globals * __cxa_get_globals() noexcept;
120 #endif
122 #if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE
123 namespace __cxxabiv1 {
124 extern "C" std::type_info *__cxa_current_exception_type() throw();
126 #endif
128 #if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
129 namespace __cxxabiv1 {
130 extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
132 #endif
134 #if !HAVE_CXXABI_H_CXA_THROW
135 namespace __cxxabiv1 {
136 extern "C" void __cxa_throw(
137 void * thrown_exception, void * tinfo, void (* dest)(void *))
138 __attribute__((noreturn));
140 #endif
142 namespace abi_aarch64 {
144 void mapException(
145 __cxxabiv1::__cxa_exception * exception, std::type_info const * type, uno_Any * any, uno_Mapping * mapping);
147 void raiseException(uno_Any * any, uno_Mapping * mapping);
149 enum ReturnKind {
150 RETURN_KIND_REG, RETURN_KIND_HFA_FLOAT, RETURN_KIND_HFA_DOUBLE,
151 RETURN_KIND_INDIRECT };
153 ReturnKind getReturnKind(typelib_TypeDescription const * type);
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */