From: Shoaib Meenai Date: Wed, 4 Jan 2017 18:53:21 +0000 (-0800) Subject: Add preprocessor macro to disable throw* definitions X-Git-Tag: v2017.03.06.00~136 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=dc938550557e34825c30056f916fd8eb81787076;p=folly.git 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 --- 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);