diff options
Diffstat (limited to 'bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx | 172 |
1 files changed, 75 insertions, 97 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx index bac7ef6fec15..96ddfc0be0b3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx @@ -27,129 +27,101 @@ #ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h #define _GLIBCXX_CDTOR_CALLABI #endif -#include <unwind.h> -#include "config_cxxabi.h" +#include "config_gcc.h" #include "uno/any2.h" #include "uno/mapping.h" -#if !HAVE_CXXABI_H_CLASS_TYPE_INFO -// <https://mentorembedded.github.io/cxx-abi/abi.html>, -// libstdc++-v3/libsupc++/cxxabi.h: -namespace __cxxabiv1 { -class __class_type_info: public std::type_info { -public: - explicit __class_type_info(char const * n): type_info(n) {} - ~__class_type_info() override; -}; -} -#endif +#ifdef _LIBCPP_VERSION -#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO -// <https://mentorembedded.github.io/cxx-abi/abi.html>, -// libstdc++-v3/libsupc++/cxxabi.h: -namespace __cxxabiv1 { -class __si_class_type_info: public __class_type_info { -public: - __class_type_info const * __base_type; - explicit __si_class_type_info( - char const * n, __class_type_info const *base): - __class_type_info(n), __base_type(base) {} - ~__si_class_type_info() override; -}; -} -#endif - -#if !HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO -// <https://mentorembedded.github.io/cxx-abi/abi.html>, -// libstdc++-v3/libsupc++/cxxabi.h: -namespace __cxxabiv1 { -struct __base_class_type_info { - __class_type_info const * __base_type; -#if defined _GLIBCXX_LLP64 - long long __offset_flags; -#else - long __offset_flags; -#endif - enum __offset_flags_masks { - __virtual_mask = 0x1, - __public_mask = 0x2, - __offset_shift = 8 +namespace __cxxabiv1 +{ + struct __class_type_info : public std::type_info + { + explicit __class_type_info( const char *__n ) : type_info( __n ) { } + virtual ~__class_type_info(); }; -}; -} -#endif -#if !HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO -// <https://mentorembedded.github.io/cxx-abi/abi.html>, -// libstdc++-v3/libsupc++/cxxabi.h: -namespace __cxxabiv1 { -class __vmi_class_type_info: public __class_type_info { -public: - unsigned int __flags; - unsigned int __base_count; - __base_class_type_info __base_info[1]; - enum __flags_masks { - __non_diamond_repeat_mask = 0x1, - __diamond_shaped_mask = 0x2, - __flags_unknown_mask = 0x10 + struct __si_class_type_info : public __class_type_info + { + explicit __si_class_type_info( const char *__n, const __class_type_info *__b ) : + __class_type_info( __n ), __base_type( __b ) { } + virtual ~__si_class_type_info(); + const __class_type_info *__base_type; }; - explicit __vmi_class_type_info(char const * n, int flags): - __class_type_info(n), __flags(flags), __base_count(0) {} - ~__vmi_class_type_info() override; -}; + +extern "C" void *__cxa_allocate_exception( std::size_t thrown_size ) _NOEXCEPT; + +extern "C" _LIBCPP_NORETURN void __cxa_throw( + void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ); } -#endif -#if !HAVE_CXXABI_H_CXA_EH_GLOBALS -// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>, -// libcxxabi/src/cxa_exception.hpp: -namespace __cxxabiv1 { -struct __cxa_exception { -#if defined _LIBCPPABI_VERSION // detect libc++abi -#if defined __LP64__ || LIBCXXABI_ARM_EHABI - std::size_t referenceCount; -#endif -#endif - std::type_info * exceptionType; - void (* exceptionDestructor)(void *); - std::unexpected_handler unexpectedHandler; - std::terminate_handler terminateHandler; - __cxa_exception * nextException; +#else + +namespace CPPU_CURRENT_NAMESPACE +{ + +// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h + +struct _Unwind_Exception +{ + unsigned exception_class __attribute__((__mode__(__DI__))); + void * exception_cleanup; + unsigned private_1 __attribute__((__mode__(__word__))); + unsigned private_2 __attribute__((__mode__(__word__))); +} __attribute__((__aligned__)); + +struct __cxa_exception +{ + ::std::type_info *exceptionType; + void (*exceptionDestructor)(void *); + + ::std::unexpected_handler unexpectedHandler; + ::std::terminate_handler terminateHandler; + + __cxa_exception *nextException; + int handlerCount; + int handlerSwitchValue; - char const * actionRecord; - char const * languageSpecificData; - void * catchTemp; - void * adjustedPtr; + const unsigned char *actionRecord; + const unsigned char *languageSpecificData; + void *catchTemp; + void *adjustedPtr; + _Unwind_Exception unwindHeader; }; -} -#endif -#if !HAVE_CXXABI_H_CXA_EH_GLOBALS -// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>: -namespace __cxxabiv1 { -struct __cxa_eh_globals { - __cxa_exception * caughtExceptions; +struct __cxa_eh_globals +{ + __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; }; -} -#endif -#if !HAVE_CXXABI_H_CXA_GET_GLOBALS -namespace __cxxabiv1 { -extern "C" __cxa_eh_globals * __cxa_get_globals() throw(); } + +// __cxa_get_globals is exported from libstdc++ since GCC 3.4.0 (CXXABI_1.3), +// but it is only declared in cxxabi.h (in namespace __cxxabiv1) since +// GCC 4.7.0. It returns a pointer to a struct __cxa_eh_globals, but that +// struct is only incompletely declared even in the GCC 4.7.0 cxxabi.h. +// Therefore, provide a declaration here for old GCC (libstdc++, really) version +// that returns a void pointer, and in the code calling it always cast to the +// above fake definition of CPPU_CURRENT_NAMESPACE::__cxa_eh_globals (which +// hopefully keeps matching the real definition in libstdc++); similarly for +// __cxa_allocate_exception and __cxa_throw, though they do not have the +// additional problem of an incompletely declared return type: + +#if !HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS +namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); } #endif -#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION +#if !HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION namespace __cxxabiv1 { extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw(); } #endif -#if !HAVE_CXXABI_H_CXA_THROW +#if !HAVE_GCC_CXXABI_H_CXA_THROW namespace __cxxabiv1 { extern "C" void __cxa_throw( void * thrown_exception, void * tinfo, void (* dest)(void *)) @@ -157,6 +129,8 @@ extern "C" void __cxa_throw( } #endif +#endif + extern "C" void privateSnippetExecutor( ... ); namespace CPPU_CURRENT_NAMESPACE @@ -166,7 +140,11 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); void fillUnoException( +#ifdef _LIBCPP_VERSION __cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +#else + __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); +#endif } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |