From aae92d274ff2bf4cf61d352071b48368b01b7b49 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 17 Dec 2019 22:44:19 -0800 Subject: [PATCH] FreeBSD build fix proposal. (#1281) Summary: - __cxa_get_globals signature closer of the libcxxabi. - malloc.h exists now on FreeBSD but prevents stdlib.h inclusion if __STDC__. Pull Request resolved: https://github.com/facebook/folly/pull/1281 Reviewed By: Orvid Differential Revision: D19140640 Pulled By: yfeldblum fbshipit-source-id: 525014b5a367b8d8e95cf10e3e779cd7f0647bd5 --- folly/lang/UncaughtExceptions.h | 2 +- folly/memory/Malloc.h | 3 +++ folly/portability/Malloc.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/folly/lang/UncaughtExceptions.h b/folly/lang/UncaughtExceptions.h index f0e1f3567ad..a00c2575f12 100644 --- a/folly/lang/UncaughtExceptions.h +++ b/folly/lang/UncaughtExceptions.h @@ -28,7 +28,7 @@ struct __cxa_eh_globals; extern "C" __cxa_eh_globals* __cxa_get_globals() noexcept; #else // Signature mismatch with FreeBSD case -extern "C" __cxa_eh_globals* __cxa_get_globals(); +extern "C" __cxa_eh_globals* __cxa_get_globals(void); #endif } // namespace __cxxabiv1 #elif defined(FOLLY_FORCE_EXCEPTION_COUNT_USE_STD) || defined(_MSC_VER) diff --git a/folly/memory/Malloc.h b/folly/memory/Malloc.h index 8c843ebfc91..04b078415b3 100644 --- a/folly/memory/Malloc.h +++ b/folly/memory/Malloc.h @@ -45,9 +45,12 @@ // for malloc_usable_size // NOTE: FreeBSD 9 doesn't have malloc.h. Its definitions // are found in stdlib.h. +// However FreeBSD 11 and so does have it. +#if !defined(__FreeBSD__) #if __has_include() #include #endif +#endif #include #include diff --git a/folly/portability/Malloc.h b/folly/portability/Malloc.h index 787030d5480..70b5d6fb3b4 100644 --- a/folly/portability/Malloc.h +++ b/folly/portability/Malloc.h @@ -30,9 +30,11 @@ // malloc_usable_size, and that's what we should be using. #include // @manual #else +#if !defined(__FreeBSD__) #if __has_include() #include #endif +#endif #if defined(__APPLE__) && !defined(FOLLY_HAVE_MALLOC_USABLE_SIZE) // MacOS doesn't have malloc_usable_size()