Added a flag FOLLY_FORCE_EXCEPTION_COUNT_USE_STD
authorMarko Novakovic <mnovakovic@fb.com>
Fri, 25 Aug 2017 22:23:42 +0000 (15:23 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 25 Aug 2017 22:34:08 +0000 (15:34 -0700)
Summary:
The flag FOLLY_FORCE_EXCEPTION_COUNT_USE_STD forces
the usage of std:uncaught_exceptions() for folly's
implementation of uncaught_exceptions()

Reviewed By: yfeldblum

Differential Revision: D5542302

fbshipit-source-id: 2c2f507ab9dde916a160a9c370a267cdcfd7203a

folly/UncaughtExceptions.h

index b9dd5fae6722b419bd9d46e1234d438a2d00a3e3..0c2a63364123a396944fff99df616dbdca0e1f81 100644 (file)
@@ -18,7 +18,8 @@
 
 #include <exception>
 
-#if defined(__GNUG__) || defined(__clang__)
+#if !defined(FOLLY_FORCE_EXCEPTION_COUNT_USE_STD) && \
+    (defined(__GNUG__) || defined(__clang__))
 #define FOLLY_EXCEPTION_COUNT_USE_CXA_GET_GLOBALS
 namespace __cxxabiv1 {
 // forward declaration (originally defined in unwind-cxx.h from from libstdc++)
@@ -32,7 +33,8 @@ extern "C" __cxa_eh_globals* __cxa_get_globals() noexcept;
 // forward declaration (originally defined in mtdll.h from MSVCRT)
 struct _tiddata;
 extern "C" _tiddata* _getptd(); // declared in mtdll.h from MSVCRT
-#elif defined(_MSC_VER) && (_MSC_VER >= 1900) // MSVC++ 2015
+#elif defined(FOLLY_FORCE_EXCEPTION_COUNT_USE_STD) || \
+    (defined(_MSC_VER) && (_MSC_VER >= 1900)) // MSVC++ 2015
 #define FOLLY_EXCEPTION_COUNT_USE_STD
 #else
 // Raise an error when trying to use this on unsupported platforms.