[libcxx] r322617 - libcxx: Stop using private MSVC macros in the exception implementation.
Peter Collingbourne via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 16 20:37:04 PST 2018
Author: pcc
Date: Tue Jan 16 20:37:04 2018
New Revision: 322617
URL: http://llvm.org/viewvc/llvm-project?rev=322617&view=rev
Log:
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
Modified:
libcxx/trunk/include/__config
libcxx/trunk/src/support/runtime/exception_msvc.ipp
libcxx/trunk/src/support/runtime/exception_pointer_msvc.ipp
Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=322617&r1=322616&r2=322617&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Tue Jan 16 20:37:04 2018
@@ -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
Modified: libcxx/trunk/src/support/runtime/exception_msvc.ipp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/runtime/exception_msvc.ipp?rev=322617&r1=322616&r2=322617&view=diff
==============================================================================
--- libcxx/trunk/src/support/runtime/exception_msvc.ipp (original)
+++ libcxx/trunk/src/support/runtime/exception_msvc.ipp Tue Jan 16 20:37:04 2018
@@ -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 {
Modified: libcxx/trunk/src/support/runtime/exception_pointer_msvc.ipp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/runtime/exception_pointer_msvc.ipp?rev=322617&r1=322616&r2=322617&view=diff
==============================================================================
--- libcxx/trunk/src/support/runtime/exception_pointer_msvc.ipp (original)
+++ libcxx/trunk/src/support/runtime/exception_pointer_msvc.ipp Tue Jan 16 20:37:04 2018
@@ -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 {
More information about the cfe-commits
mailing list