From: ktietz Date: Fri, 16 Dec 2011 18:43:06 +0000 (+0000) Subject: PR libstdc++/51135 X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=e01c35d8ddb90216a85ad34ea8190bd65b409086 PR libstdc++/51135 * libsupc++/unwind-cxx.h (__cxa_exception): Mark exceptionDestructor by _GLIBCXX_CDTOR_CALLABI. * libsupc++/eh_throw.cc (__cxa_throw): Mark destructor function argument by _GLIBCXX_CDTOR_CALLABI. * libsupc++/cxxabi.h (__cxa_throw): Likewise. (_GLIBCXX_CDTOR_CALLABI): Add empty default definition. * config/os/mingw32-w64/os_defines.h (_GLIBCXX_CDTOR_CALLABI): Define for IA-32 target as __thiscall. * config/os/mingw32/os_defines.h (_GLIBCXX_CDTOR_CALLABI): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182410 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/config/os/mingw32-w64/os_defines.h b/libstdc++-v3/config/os/mingw32-w64/os_defines.h index 160c1ffda58..f82e25c76a7 100644 --- a/libstdc++-v3/config/os/mingw32-w64/os_defines.h +++ b/libstdc++-v3/config/os/mingw32-w64/os_defines.h @@ -65,4 +65,11 @@ // ioctlsocket function doesn't work for normal file-descriptors. #define _GLIBCXX_NO_IOCTL 1 +// See libstdc++/51135 +// Class constructors/destructors have __thiscall calling-convention on +// IA 32-bit +#if defined (__i386__) +#define _GLIBCXX_CDTOR_CALLABI __thiscall +#endif + #endif diff --git a/libstdc++-v3/config/os/mingw32/os_defines.h b/libstdc++-v3/config/os/mingw32/os_defines.h index 160c1ffda58..f82e25c76a7 100644 --- a/libstdc++-v3/config/os/mingw32/os_defines.h +++ b/libstdc++-v3/config/os/mingw32/os_defines.h @@ -65,4 +65,11 @@ // ioctlsocket function doesn't work for normal file-descriptors. #define _GLIBCXX_NO_IOCTL 1 +// See libstdc++/51135 +// Class constructors/destructors have __thiscall calling-convention on +// IA 32-bit +#if defined (__i386__) +#define _GLIBCXX_CDTOR_CALLABI __thiscall +#endif + #endif diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h index aeaf4ccf4aa..b924fc17079 100644 --- a/libstdc++-v3/libsupc++/cxxabi.h +++ b/libstdc++-v3/libsupc++/cxxabi.h @@ -51,6 +51,10 @@ #include #include +#ifndef _GLIBCXX_CDTOR_CALLABI +#define _GLIBCXX_CDTOR_CALLABI +#endif + #ifdef __cplusplus namespace __cxxabiv1 { @@ -596,7 +600,7 @@ namespace __cxxabiv1 // Throw the exception. void - __cxa_throw(void*, std::type_info*, void (*) (void *)) + __cxa_throw(void*, std::type_info*, void (_GLIBCXX_CDTOR_CALLABI *) (void *)) __attribute__((__noreturn__)); // Used to implement exception handlers. diff --git a/libstdc++-v3/libsupc++/eh_throw.cc b/libstdc++-v3/libsupc++/eh_throw.cc index 0e7083c9033..a3d2b0d24b2 100644 --- a/libstdc++-v3/libsupc++/eh_throw.cc +++ b/libstdc++-v3/libsupc++/eh_throw.cc @@ -59,7 +59,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc) extern "C" void __cxxabiv1::__cxa_throw (void *obj, std::type_info *tinfo, - void (*dest) (void *)) + void (_GLIBCXX_CDTOR_CALLABI *dest) (void *)) { // Definitely a primary. __cxa_refcounted_exception *header diff --git a/libstdc++-v3/libsupc++/unwind-cxx.h b/libstdc++-v3/libsupc++/unwind-cxx.h index 3ce32e969f5..b0cdeae1150 100644 --- a/libstdc++-v3/libsupc++/unwind-cxx.h +++ b/libstdc++-v3/libsupc++/unwind-cxx.h @@ -51,7 +51,7 @@ struct __cxa_exception { // Manage the exception object itself. std::type_info *exceptionType; - void (*exceptionDestructor)(void *); + void (_GLIBCXX_CDTOR_CALLABI *exceptionDestructor)(void *); // The C++ standard has entertaining rules wrt calling set_terminate // and set_unexpected in the middle of the exception cleanup process.