Make Malloc.h self-contained again
authorGiuseppe Ottaviano <ott@fb.com>
Tue, 23 Aug 2016 17:14:40 +0000 (10:14 -0700)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Tue, 23 Aug 2016 17:23:27 +0000 (10:23 -0700)
Summary: D3743475 adds to `Malloc.h` a dependency on another folly header, which breaks it when used in stand-alone mode. This diff moves the include to the right `#ifdef` section.

Reviewed By: Gownta

Differential Revision: D3757819

fbshipit-source-id: 71664ca6a3a47b6e4449a4ef603fedf052c5df3b

folly/Malloc.h

index 64fd393ddd7ac592cfbdc0f6961d54130fb1ceb6..fec188f5b9c3f248a293dee12a70eac8764a74cc 100644 (file)
@@ -20,8 +20,6 @@
 #pragma once
 #define FOLLY_MALLOC_H_
 
-#include <folly/portability/BitsFunctexcept.h>
-
 /**
  * Define various MALLOCX_* macros normally provided by jemalloc.  We define
  * them so that we don't have to include jemalloc.h, in case the program is
@@ -42,6 +40,7 @@
 #if defined(_GLIBCXX_USE_FB) && !defined(_LIBSTDCXX_FBSTRING)
 
 #include <folly/detail/Malloc.h>
+#include <folly/portability/BitsFunctexcept.h>
 
 #include <string>
 
@@ -87,13 +86,19 @@ extern "C" int mallctlbymib(const size_t*, size_t, void*, size_t*, void*,
                             size_t)
 __attribute__((__weak__));
 
+#include <bits/functexcept.h>
+
 #define FOLLY_HAVE_MALLOC_H 1
-#else
+
+#else // !defined(_LIBSTDCXX_FBSTRING)
+
 #include <folly/detail/Malloc.h> /* nolint */
+#include <folly/portability/BitsFunctexcept.h> /* nolint */
+
 #endif
 
 // for malloc_usable_size
-// NOTE: FreeBSD 9 doesn't have malloc.h.  It's defitions
+// NOTE: FreeBSD 9 doesn't have malloc.h.  Its definitions
 // are found in stdlib.h.
 #if FOLLY_HAVE_MALLOC_H
 #include <malloc.h>