[libcxxabi] Use the right calling convention for exception destructors on i386 Windows
On Windows on i386, C++ member functions use a different calling convention (`__thiscall`) than the default one for regular functions (`__cdecl`). (On Windows on architectures other than i386, both calling convention attributes are no-ops.) This matches how libstdc++ declares these types. This fixes the std/thread/futures/futures.{shared,unique}_future/dtor.pass.cpp tests on i386 mingw. Differential Revision: https://reviews.llvm.org/D124990
This commit is contained in:
parent
448eabd754
commit
aeb4907ed6
|
@ -97,4 +97,10 @@
|
||||||
# define _LIBCXXABI_NO_EXCEPTIONS
|
# define _LIBCXXABI_NO_EXCEPTIONS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define _LIBCXXABI_DTOR_FUNC __thiscall
|
||||||
|
#else
|
||||||
|
#define _LIBCXXABI_DTOR_FUNC
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // ____CXXABI_CONFIG_H
|
#endif // ____CXXABI_CONFIG_H
|
||||||
|
|
|
@ -47,7 +47,7 @@ __cxa_free_exception(void *thrown_exception) throw();
|
||||||
// 2.4.3 Throwing the Exception Object
|
// 2.4.3 Throwing the Exception Object
|
||||||
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
|
extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
|
||||||
__cxa_throw(void *thrown_exception, std::type_info *tinfo,
|
__cxa_throw(void *thrown_exception, std::type_info *tinfo,
|
||||||
void (*dest)(void *));
|
void (_LIBCXXABI_DTOR_FUNC *dest)(void *));
|
||||||
|
|
||||||
// 2.5.3 Exception Handlers
|
// 2.5.3 Exception Handlers
|
||||||
extern _LIBCXXABI_FUNC_VIS void *
|
extern _LIBCXXABI_FUNC_VIS void *
|
||||||
|
|
|
@ -254,7 +254,7 @@ will call terminate, assuming that there was no handler for the
|
||||||
exception.
|
exception.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__cxa_throw(void *thrown_object, std::type_info *tinfo, void (*dest)(void *)) {
|
__cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
|
||||||
__cxa_eh_globals *globals = __cxa_get_globals();
|
__cxa_eh_globals *globals = __cxa_get_globals();
|
||||||
__cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object);
|
__cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct _LIBCXXABI_HIDDEN __cxa_exception {
|
||||||
|
|
||||||
// Manage the exception object itself.
|
// Manage the exception object itself.
|
||||||
std::type_info *exceptionType;
|
std::type_info *exceptionType;
|
||||||
void (*exceptionDestructor)(void *);
|
void (_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
|
||||||
std::unexpected_handler unexpectedHandler;
|
std::unexpected_handler unexpectedHandler;
|
||||||
std::terminate_handler terminateHandler;
|
std::terminate_handler terminateHandler;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ struct _LIBCXXABI_HIDDEN __cxa_dependent_exception {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::type_info *exceptionType;
|
std::type_info *exceptionType;
|
||||||
void (*exceptionDestructor)(void *);
|
void (_LIBCXXABI_DTOR_FUNC *exceptionDestructor)(void *);
|
||||||
std::unexpected_handler unexpectedHandler;
|
std::unexpected_handler unexpectedHandler;
|
||||||
std::terminate_handler terminateHandler;
|
std::terminate_handler terminateHandler;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue