libcxx: Stop using private MSVC macros in the exception implementation.

Inline the provided "fallback" definitions (which seem to always be
taken) that expand to __cdecl into users. The fallback definitions
for the *CRTIMP* macros were wrong in the case where the CRT is being
linked statically, so define our own macro as a replacement.

Differential Revision: https://reviews.llvm.org/D42158

llvm-svn: 322617
This commit is contained in:
Peter Collingbourne 2018-01-17 04:37:04 +00:00
parent 77ba1e7c08
commit 4bdb80faf2
3 changed files with 23 additions and 43 deletions

View File

@ -626,6 +626,12 @@ namespace std {
#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
#ifdef _DLL
# define _LIBCPP_CRT_FUNC __declspec(dllimport)
#else
# define _LIBCPP_CRT_FUNC
#endif
#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
# define _LIBCPP_DLL_VIS
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS

View File

@ -15,30 +15,18 @@
#include <stdio.h>
#include <stdlib.h>
#if !defined(_ACRTIMP)
#define _ACRTIMP __declspec(dllimport)
#endif
#if !defined(_VCRTIMP)
#define _VCRTIMP __declspec(dllimport)
#endif
#if !defined(__CRTDECL)
#define __CRTDECL __cdecl
#endif
extern "C" {
typedef void (__CRTDECL* terminate_handler)();
_ACRTIMP terminate_handler __cdecl set_terminate(
typedef void (__cdecl* terminate_handler)();
_LIBCPP_CRT_FUNC terminate_handler __cdecl set_terminate(
terminate_handler _NewTerminateHandler) throw();
_ACRTIMP terminate_handler __cdecl _get_terminate();
_LIBCPP_CRT_FUNC terminate_handler __cdecl _get_terminate();
typedef void (__CRTDECL* unexpected_handler)();
_VCRTIMP unexpected_handler __cdecl set_unexpected(
typedef void (__cdecl* unexpected_handler)();
_LIBCPP_CRT_FUNC unexpected_handler __cdecl set_unexpected(
unexpected_handler _NewUnexpectedHandler) throw();
_VCRTIMP unexpected_handler __cdecl _get_unexpected();
_LIBCPP_CRT_FUNC unexpected_handler __cdecl _get_unexpected();
_VCRTIMP int __cdecl __uncaught_exceptions();
_LIBCPP_CRT_FUNC int __cdecl __uncaught_exceptions();
}
namespace std {

View File

@ -11,30 +11,16 @@
#include <stdio.h>
#include <stdlib.h>
#if !defined(_CRTIMP2_PURE)
#define _CRTIMP2_PURE __declspec(dllimport)
#endif
#if !defined(__CLRCALL_PURE_OR_CDECL)
#define __CLRCALL_PURE_OR_CDECL __cdecl
#endif
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCreate(void*);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrDestroy(void*);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCopy(void*,
const void*);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL
__ExceptionPtrAssign(void*, const void*);
_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL
__ExceptionPtrCompare(const void*, const void*);
_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL
__ExceptionPtrToBool(const void*);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrSwap(void*, void*);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL
__ExceptionPtrCurrentException(void*);
[[noreturn]] _CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL
__ExceptionPtrRethrow(const void*);
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL
_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCreate(void*);
_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrDestroy(void*);
_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCopy(void*, const void*);
_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrAssign(void*, const void*);
_LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrCompare(const void*, const void*);
_LIBCPP_CRT_FUNC bool __cdecl __ExceptionPtrToBool(const void*);
_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrSwap(void*, void*);
_LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrCurrentException(void*);
[[noreturn]] _LIBCPP_CRT_FUNC void __cdecl __ExceptionPtrRethrow(const void*);
_LIBCPP_CRT_FUNC void __cdecl
__ExceptionPtrCopyException(void*, const void*, const void*);
namespace std {