summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2018-01-17 04:37:04 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2018-01-17 04:37:04 +0000
commit4bdb80faf2dda9818ee98456f90ae356c201ee05 (patch)
tree95afb474ee2d5a7dbab6635c01f2cb5df2b44650
parent77ba1e7c0801f36ee3af769610244846a6e1bf5a (diff)
downloadbcm5719-llvm-4bdb80faf2dda9818ee98456f90ae356c201ee05.tar.gz
bcm5719-llvm-4bdb80faf2dda9818ee98456f90ae356c201ee05.zip
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
-rw-r--r--libcxx/include/__config6
-rw-r--r--libcxx/src/support/runtime/exception_msvc.ipp26
-rw-r--r--libcxx/src/support/runtime/exception_pointer_msvc.ipp34
3 files changed, 23 insertions, 43 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 94832ff40e1..aa064529ee0 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -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
diff --git a/libcxx/src/support/runtime/exception_msvc.ipp b/libcxx/src/support/runtime/exception_msvc.ipp
index d5bf5b726ea..7dc1b57d48e 100644
--- a/libcxx/src/support/runtime/exception_msvc.ipp
+++ b/libcxx/src/support/runtime/exception_msvc.ipp
@@ -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 {
diff --git a/libcxx/src/support/runtime/exception_pointer_msvc.ipp b/libcxx/src/support/runtime/exception_pointer_msvc.ipp
index 5ca7519a600..9b0d2361e40 100644
--- a/libcxx/src/support/runtime/exception_pointer_msvc.ipp
+++ b/libcxx/src/support/runtime/exception_pointer_msvc.ipp
@@ -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 {
OpenPOWER on IntegriCloud