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
// 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) {
} // namespace folly
#endif /* !__POPCNT__ */
-
#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)