1*74f1be36SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*74f1be36SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*74f1be36SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*74f1be36SAndrew Rist  * distributed with this work for additional information
6*74f1be36SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*74f1be36SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*74f1be36SAndrew Rist  * "License"); you may not use this file except in compliance
9*74f1be36SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*74f1be36SAndrew Rist  *
11*74f1be36SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*74f1be36SAndrew Rist  *
13*74f1be36SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*74f1be36SAndrew Rist  * software distributed under the License is distributed on an
15*74f1be36SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*74f1be36SAndrew Rist  * KIND, either express or implied.  See the License for the
17*74f1be36SAndrew Rist  * specific language governing permissions and limitations
18*74f1be36SAndrew Rist  * under the License.
19*74f1be36SAndrew Rist  *
20*74f1be36SAndrew Rist  *************************************************************/
21*74f1be36SAndrew Rist 
22*74f1be36SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "uno/mapping.h"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <typeinfo>
27cdf0e10cSrcweir #include <exception>
28cdf0e10cSrcweir #include <cstddef>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir namespace CPPU_CURRENT_NAMESPACE
31cdf0e10cSrcweir {
32cdf0e10cSrcweir 
33cdf0e10cSrcweir   void dummy_can_throw_anything( char const * );
34cdf0e10cSrcweir 
35cdf0e10cSrcweir 
36cdf0e10cSrcweir // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
37cdf0e10cSrcweir 
38cdf0e10cSrcweir struct _Unwind_Exception
39cdf0e10cSrcweir {
40cdf0e10cSrcweir     unsigned exception_class __attribute__((__mode__(__DI__)));
41cdf0e10cSrcweir     void * exception_cleanup;
42cdf0e10cSrcweir     unsigned private_1 __attribute__((__mode__(__word__)));
43cdf0e10cSrcweir     unsigned private_2 __attribute__((__mode__(__word__)));
44cdf0e10cSrcweir } __attribute__((__aligned__));
45cdf0e10cSrcweir 
46cdf0e10cSrcweir struct __cxa_exception
47cdf0e10cSrcweir {
48cdf0e10cSrcweir     ::std::type_info *exceptionType;
49cdf0e10cSrcweir     void (*exceptionDestructor)(void *);
50cdf0e10cSrcweir 
51cdf0e10cSrcweir     ::std::unexpected_handler unexpectedHandler;
52cdf0e10cSrcweir     ::std::terminate_handler terminateHandler;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     __cxa_exception *nextException;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     int handlerCount;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     int handlerSwitchValue;
59cdf0e10cSrcweir     const unsigned char *actionRecord;
60cdf0e10cSrcweir     const unsigned char *languageSpecificData;
61cdf0e10cSrcweir     void *catchTemp;
62cdf0e10cSrcweir     void *adjustedPtr;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     _Unwind_Exception unwindHeader;
65cdf0e10cSrcweir };
66cdf0e10cSrcweir 
67cdf0e10cSrcweir extern "C" void *__cxa_allocate_exception(
68cdf0e10cSrcweir     std::size_t thrown_size ) throw();
69cdf0e10cSrcweir extern "C" void __cxa_throw (
70cdf0e10cSrcweir     void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
71cdf0e10cSrcweir 
72cdf0e10cSrcweir struct __cxa_eh_globals
73cdf0e10cSrcweir {
74cdf0e10cSrcweir     __cxa_exception *caughtExceptions;
75cdf0e10cSrcweir     unsigned int uncaughtExceptions;
76cdf0e10cSrcweir };
77cdf0e10cSrcweir extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir // -----
80cdf0e10cSrcweir 
81cdf0e10cSrcweir //==================================================================================================
82cdf0e10cSrcweir void raiseException(
83cdf0e10cSrcweir     uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
84cdf0e10cSrcweir //==================================================================================================
85cdf0e10cSrcweir void fillUnoException(
86cdf0e10cSrcweir     __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
87cdf0e10cSrcweir }
88