From 2a0c9d069374e5953625ae45aaa9ccbece7a7f5d Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Mon, 22 Aug 2016 09:52:34 -0700 Subject: [PATCH] More fixup of the build on Mac for HHVM Summary: `std::__throw_bad_alloc()` is defined in `` on OSX, so bring back the `#ifdef` guards that were there previously. Reviewed By: markw65 Differential Revision: D3749714 fbshipit-source-id: 0338a4cece928fce0b9d33d41c17cfa99a319abe --- folly/portability/BitsFunctexcept.cpp | 2 ++ folly/portability/BitsFunctexcept.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/folly/portability/BitsFunctexcept.cpp b/folly/portability/BitsFunctexcept.cpp index 55b95616..1a72b69b 100644 --- a/folly/portability/BitsFunctexcept.cpp +++ b/folly/portability/BitsFunctexcept.cpp @@ -33,9 +33,11 @@ void __throw_out_of_range(const char* msg) { throw std::out_of_range(msg); } +#ifdef _MSC_VER void __throw_bad_alloc() { throw std::bad_alloc(); } +#endif FOLLY_NAMESPACE_STD_END #endif diff --git a/folly/portability/BitsFunctexcept.h b/folly/portability/BitsFunctexcept.h index 80b2cb2a..098d1e7b 100644 --- a/folly/portability/BitsFunctexcept.h +++ b/folly/portability/BitsFunctexcept.h @@ -21,13 +21,17 @@ #if FOLLY_HAVE_BITS_FUNCTEXCEPT_H #include #else +#include // Some platforms define __throw_bad_alloc() here. #include FOLLY_NAMESPACE_STD_BEGIN [[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); + +#ifdef _MSC_VER [[noreturn]] void __throw_bad_alloc(); +#endif FOLLY_NAMESPACE_STD_END #endif -- 2.34.1