Commit 16d227a1 authored by Todd Nowacki's avatar Todd Nowacki Committed by Jordan DeLong

Folly Changes for Clang, revision 1

Summary:
Depends on D829162 and D830052

A few changes are needed to get folly compiling with clang.
There are likely more changes to compile all of folly

---folly/Bits.cpp
+++folly/folly-config.h
Moved ifunc check, and added an additional check for clang, instead of hard
coding it to be 1

~~~folly/Range.cpp
Moved the declaration of a function to get rid of clang's unused function
warning.

Test Plan:
This bit of code was a dependency in another project.
That code compiled as it needed to

See other diff for more test details

Reviewed By: oyamauchi@fb.com

FB internal diff: D830075
parent a2d09ab3
......@@ -22,16 +22,6 @@
// popcnt
#ifndef __POPCNT__
// Clang doesn't support ifuncs. This also allows ifunc support to be explicitly
// passed in as a compile flag.
#ifndef FOLLY_HAVE_IFUNC
# ifdef __clang__
# define FOLLY_HAVE_IFUNC 0
# else
# define FOLLY_HAVE_IFUNC 1
# endif
#endif
namespace {
int popcount_builtin(unsigned int x) {
......@@ -102,4 +92,3 @@ int popcountll(unsigned long long x)
} // namespace folly
#endif /* !__POPCNT__ */
......@@ -65,14 +65,15 @@ static_assert(kMinPageSize >= 16,
#define PAGE_FOR(addr) \
(reinterpret_cast<uintptr_t>(addr) / kMinPageSize)
#if FOLLY_HAVE_EMMINTRIN_H
inline size_t nextAlignedIndex(const char* arr) {
auto firstPossible = reinterpret_cast<uintptr_t>(arr) + 1;
return 1 + // add 1 because the index starts at 'arr'
((firstPossible + 15) & ~0xF) // round up to next multiple of 16
- firstPossible;
auto firstPossible = reinterpret_cast<uintptr_t>(arr) + 1;
return 1 + // add 1 because the index starts at 'arr'
((firstPossible + 15) & ~0xF) // round up to next multiple of 16
- firstPossible;
}
#if FOLLY_HAVE_EMMINTRIN_H
// build sse4.2-optimized version even if -msse4.2 is not passed to GCC
size_t qfind_first_byte_of_needles16(const StringPiece& haystack,
const StringPiece& needles)
......
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