nss: upgrade to release 3.73
[LibreOffice.git] / bridges / source / cpp_uno / gcc3_macosx_x86-64 / share.hxx
blobdeada0c17ac3c59d03c23b5d165c7498d230c781
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 .
19 #pragma once
21 #include <uno/mapping.h>
23 #include <typeinfo>
24 #include <exception>
25 #include <cstddef>
27 namespace CPPU_CURRENT_NAMESPACE
30 // From opensource.apple.com: libunwind-35.1/include/unwind.h
32 typedef enum {
33 _URC_NO_REASON = 0,
34 _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
35 _URC_FATAL_PHASE2_ERROR = 2,
36 _URC_FATAL_PHASE1_ERROR = 3,
37 _URC_NORMAL_STOP = 4,
38 _URC_END_OF_STACK = 5,
39 _URC_HANDLER_FOUND = 6,
40 _URC_INSTALL_CONTEXT = 7,
41 _URC_CONTINUE_UNWIND = 8
42 } _Unwind_Reason_Code;
44 struct _Unwind_Exception
46 uint64_t exception_class;
47 void (*exception_cleanup)(_Unwind_Reason_Code reason, struct _Unwind_Exception* exc);
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
59 // From libcppabi-24.2/include/unwind-cxx.h
61 typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__)));
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.
67 struct __cxa_exception
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.
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
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 *);
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;
100 // The caught exception stack threads through here.
101 __cxa_exception *nextException;
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;
107 #ifdef __ARM_EABI_UNWINDER__
108 // Stack of exceptions in cleanups.
109 __cxa_exception* nextPropagatingException;
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.
116 int handlerSwitchValue;
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.
126 size_t referenceCount;
127 #endif
129 // The generic exception header. Must be last.
130 _Unwind_Exception unwindHeader;
133 // Each thread in a C++ program has access to a __cxa_eh_globals object.
134 struct __cxa_eh_globals
136 __cxa_exception *caughtExceptions;
137 unsigned int uncaughtExceptions;
138 #ifdef __ARM_EABI_UNWINDER__
139 __cxa_exception* propagatingExceptions;
140 #endif
145 extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw();
147 namespace CPPU_CURRENT_NAMESPACE
150 void raiseException(
151 uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
153 void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno);
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */