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 @@ ...@@ -22,16 +22,6 @@
// popcnt // popcnt
#ifndef __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 { namespace {
int popcount_builtin(unsigned int x) { int popcount_builtin(unsigned int x) {
...@@ -102,4 +92,3 @@ int popcountll(unsigned long long x) ...@@ -102,4 +92,3 @@ int popcountll(unsigned long long x)
} // namespace folly } // namespace folly
#endif /* !__POPCNT__ */ #endif /* !__POPCNT__ */
...@@ -65,6 +65,8 @@ static_assert(kMinPageSize >= 16, ...@@ -65,6 +65,8 @@ static_assert(kMinPageSize >= 16,
#define PAGE_FOR(addr) \ #define PAGE_FOR(addr) \
(reinterpret_cast<uintptr_t>(addr) / kMinPageSize) (reinterpret_cast<uintptr_t>(addr) / kMinPageSize)
#if FOLLY_HAVE_EMMINTRIN_H
inline size_t nextAlignedIndex(const char* arr) { inline size_t nextAlignedIndex(const char* arr) {
auto firstPossible = reinterpret_cast<uintptr_t>(arr) + 1; auto firstPossible = reinterpret_cast<uintptr_t>(arr) + 1;
return 1 + // add 1 because the index starts at 'arr' return 1 + // add 1 because the index starts at 'arr'
...@@ -72,7 +74,6 @@ inline size_t nextAlignedIndex(const char* arr) { ...@@ -72,7 +74,6 @@ inline size_t nextAlignedIndex(const char* arr) {
- firstPossible; - firstPossible;
} }
#if FOLLY_HAVE_EMMINTRIN_H
// build sse4.2-optimized version even if -msse4.2 is not passed to GCC // build sse4.2-optimized version even if -msse4.2 is not passed to GCC
size_t qfind_first_byte_of_needles16(const StringPiece& haystack, size_t qfind_first_byte_of_needles16(const StringPiece& haystack,
const StringPiece& needles) 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