From 60d9f8475af7b4cfca379279cc7dd3fe2ed83c1c Mon Sep 17 00:00:00 2001 From: Shoaib Meenai Date: Wed, 21 Sep 2016 08:07:33 -0700 Subject: [PATCH] Fix compilation for libc++ 3.9 Summary: libc++ 3.9 and above define the __throw* functions inside stdexcept, so defining them ourselves leads to compilation errors when compiling against libc++ 3.9. Add appropriate preprocessor guards to avoid this. Reviewed By: meyering Differential Revision: D3898284 fbshipit-source-id: 435a28c2b3a83ee4d8f5af0df0343c524469011e --- folly/portability/BitsFunctexcept.cpp | 2 ++ folly/portability/BitsFunctexcept.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/folly/portability/BitsFunctexcept.cpp b/folly/portability/BitsFunctexcept.cpp index 1a72b69b..f3ff3d6c 100644 --- a/folly/portability/BitsFunctexcept.cpp +++ b/folly/portability/BitsFunctexcept.cpp @@ -21,6 +21,7 @@ FOLLY_NAMESPACE_STD_BEGIN +#if !defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 3900 void __throw_length_error(const char* msg) { throw std::length_error(msg); } @@ -32,6 +33,7 @@ void __throw_logic_error(const char* msg) { void __throw_out_of_range(const char* msg) { throw std::out_of_range(msg); } +#endif #ifdef _MSC_VER void __throw_bad_alloc() { diff --git a/folly/portability/BitsFunctexcept.h b/folly/portability/BitsFunctexcept.h index 098d1e7b..080b0f33 100644 --- a/folly/portability/BitsFunctexcept.h +++ b/folly/portability/BitsFunctexcept.h @@ -25,9 +25,11 @@ #include FOLLY_NAMESPACE_STD_BEGIN +#if !defined(_LIBCPP_VERSION) || _LIBCPP_VERSION < 3900 [[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); +#endif #ifdef _MSC_VER [[noreturn]] void __throw_bad_alloc(); -- 2.34.1