Commit b22d95e4 authored by Sean Cannella's avatar Sean Cannella Committed by Sara Golemon

fix folly Range compilation on FreeBSD

Summary: - memrchr is GNU + Linux specific, it turns out

Test Plan: - compiled on FreeBSD, contbuild

Reviewed By: delong.j@fb.com

FB internal diff: D900935
parent ea2da05c
...@@ -705,7 +705,7 @@ inline size_t qfind(const Range<const char*>& haystack, const char& needle) { ...@@ -705,7 +705,7 @@ inline size_t qfind(const Range<const char*>& haystack, const char& needle) {
return pos == nullptr ? std::string::npos : pos - haystack.data(); return pos == nullptr ? std::string::npos : pos - haystack.data();
} }
#ifdef _GNU_SOURCE // memrchr is a GNU extension #if FOLLY_HAVE_MEMRCHR
template <> template <>
inline size_t rfind(const Range<const char*>& haystack, const char& needle) { inline size_t rfind(const Range<const char*>& haystack, const char& needle) {
auto pos = static_cast<const char*>( auto pos = static_cast<const char*>(
...@@ -723,7 +723,7 @@ inline size_t qfind(const Range<const unsigned char*>& haystack, ...@@ -723,7 +723,7 @@ inline size_t qfind(const Range<const unsigned char*>& haystack,
return pos == nullptr ? std::string::npos : pos - haystack.data(); return pos == nullptr ? std::string::npos : pos - haystack.data();
} }
#ifdef _GNU_SOURCE // memrchr is a GNU extension #if FOLLY_HAVE_MEMRCHR
template <> template <>
inline size_t rfind(const Range<const unsigned char*>& haystack, inline size_t rfind(const Range<const unsigned char*>& haystack,
const unsigned char& needle) { const unsigned char& needle) {
......
...@@ -86,7 +86,8 @@ AC_CHECK_FUNCS([getdelim \ ...@@ -86,7 +86,8 @@ AC_CHECK_FUNCS([getdelim \
pthread_yield \ pthread_yield \
rallocm \ rallocm \
malloc_size \ malloc_size \
malloc_usable_size]) malloc_usable_size \
memrchr])
if test "$ac_cv_func_pthread_yield" = "no"; then if test "$ac_cv_func_pthread_yield" = "no"; then
AC_CHECK_HEADERS([sched.h]) AC_CHECK_HEADERS([sched.h])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment