Add preprocessor macro to disable throw* definitions
authorShoaib Meenai <smeenai@fb.com>
Wed, 4 Jan 2017 18:53:21 +0000 (10:53 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 4 Jan 2017 19:02:58 +0000 (11:02 -0800)
Summary:
libc++ 4.0 and above define the throw* functions in `stdexcept`, so
Folly doesn't need to define them itself. In case those definitions are
backported to 3.9, add a Folly macro to skip the definitions regardless
of the libc++ version number.

Reviewed By: yfeldblum, Orvid

Differential Revision: D4378102

fbshipit-source-id: 674d98d7c448aa7e75bdd8b6e9fe965cd34a83d7

folly/portability/BitsFunctexcept.cpp
folly/portability/BitsFunctexcept.h

index 79c1e94967e23116a6813f475f8eebbafce4d5f0..1a52e96f44f3377c88e3eaa41df0fcbbc13a7a93 100644 (file)
@@ -21,7 +21,8 @@
 
 FOLLY_NAMESPACE_STD_BEGIN
 
-#if !defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 3900
+#if (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 3900) && \
+    !defined(FOLLY_SKIP_LIBCPP_4000_THROW_BACKPORTS)
 void __throw_length_error(const char* msg) {
   throw std::length_error(msg);
 }
index 870e071f6d7dd7e64be51f9ca5e7bf9c69b46f2d..1c4b8c03df370fea9ea37f049622ef1faa1e4f62 100644 (file)
@@ -25,7 +25,8 @@
 #include <folly/Portability.h>
 FOLLY_NAMESPACE_STD_BEGIN
 
-#if !defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 3900
+#if (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 3900) && \
+    !defined(FOLLY_SKIP_LIBCPP_4000_THROW_BACKPORTS)
 [[noreturn]] void __throw_length_error(const char* msg);
 [[noreturn]] void __throw_logic_error(const char* msg);
 [[noreturn]] void __throw_out_of_range(const char* msg);