More fixup of the build on Mac for HHVM
authorChristopher Dykes <cdykes@fb.com>
Mon, 22 Aug 2016 16:52:34 +0000 (09:52 -0700)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Mon, 22 Aug 2016 16:53:27 +0000 (09:53 -0700)
Summary: `std::__throw_bad_alloc()` is defined in `<new>` 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
folly/portability/BitsFunctexcept.h

index 55b95616ed84ba29f6443d77cabc52b266182977..1a72b69bd06ad971359c7f39c85ab2b05ebcd129 100644 (file)
@@ -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
index 80b2cb2a56b706875ed3ab232c4dbf3aca068484..098d1e7bf4cfdfd823b3ccf1297fa73160998aed 100644 (file)
 #if FOLLY_HAVE_BITS_FUNCTEXCEPT_H
 #include <bits/functexcept.h>
 #else
+#include <new> // Some platforms define __throw_bad_alloc() here.
 #include <folly/Portability.h>
 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