From dc938550557e34825c30056f916fd8eb81787076 Mon Sep 17 00:00:00 2001 From: Shoaib Meenai Date: Wed, 4 Jan 2017 10:53:21 -0800 Subject: [PATCH] Add preprocessor macro to disable throw* definitions 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 | 3 ++- folly/portability/BitsFunctexcept.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/folly/portability/BitsFunctexcept.cpp b/folly/portability/BitsFunctexcept.cpp index 79c1e949..1a52e96f 100644 --- a/folly/portability/BitsFunctexcept.cpp +++ b/folly/portability/BitsFunctexcept.cpp @@ -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); } diff --git a/folly/portability/BitsFunctexcept.h b/folly/portability/BitsFunctexcept.h index 870e071f..1c4b8c03 100644 --- a/folly/portability/BitsFunctexcept.h +++ b/folly/portability/BitsFunctexcept.h @@ -25,7 +25,8 @@ #include 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); -- 2.34.1