Skip to content

Commit

Permalink
FreeBSD build fix proposal. (#1281)
Browse files Browse the repository at this point in the history
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: #1281

Reviewed By: Orvid

Differential Revision: D19140640

Pulled By: yfeldblum

fbshipit-source-id: 525014b5a367b8d8e95cf10e3e779cd7f0647bd5
  • Loading branch information
devnexen authored and facebook-github-bot committed Dec 18, 2019
1 parent 8aedb40 commit aae92d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion folly/lang/UncaughtExceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions folly/memory/Malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(<malloc.h>)
#include <malloc.h>
#endif
#endif

#include <cassert>
#include <cstddef>
Expand Down
2 changes: 2 additions & 0 deletions folly/portability/Malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
// malloc_usable_size, and that's what we should be using.
#include <jemalloc/jemalloc.h> // @manual
#else
#if !defined(__FreeBSD__)
#if __has_include(<malloc.h>)
#include <malloc.h>
#endif
#endif

#if defined(__APPLE__) && !defined(FOLLY_HAVE_MALLOC_USABLE_SIZE)
// MacOS doesn't have malloc_usable_size()
Expand Down

0 comments on commit aae92d2

Please sign in to comment.