Fix compilation for libc++ 3.9
authorShoaib Meenai <smeenai@fb.com>
Wed, 21 Sep 2016 15:07:33 +0000 (08:07 -0700)
committerFacebook Github Bot 8 <facebook-github-bot-8-bot@fb.com>
Wed, 21 Sep 2016 15:08:31 +0000 (08:08 -0700)
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
folly/portability/BitsFunctexcept.h

index 1a72b69bd06ad971359c7f39c85ab2b05ebcd129..f3ff3d6cfebae82ef849d2d87ee79264745f072b 100644 (file)
@@ -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() {
index 098d1e7bf4cfdfd823b3ccf1297fa73160998aed..080b0f33ba3e79249b652cfeace7491eb4a6132d 100644 (file)
 #include <folly/Portability.h>
 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();