Commit 60d9f847 authored by Shoaib Meenai's avatar Shoaib Meenai Committed by Facebook Github Bot 8

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
parent 992ac3ae
......@@ -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() {
......
......@@ -25,9 +25,11 @@
#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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment