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