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