diff --git CMake/folly-deps.cmake CMake/folly-deps.cmake index c72273a73..eb4627637 100644 --- CMake/folly-deps.cmake +++ CMake/folly-deps.cmake @@ -247,7 +247,7 @@ check_cxx_source_compiles(" FOLLY_STDLIB_LIBCPP ) -if (APPLE) +if (APPLE AND (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) list (APPEND CMAKE_REQUIRED_LIBRARIES c++abi) list (APPEND FOLLY_LINK_LIBRARIES c++abi) endif () diff --git CMakeLists.txt CMakeLists.txt index 01a28eeab..2383b30cb 100644 --- CMakeLists.txt +++ CMakeLists.txt @@ -708,7 +708,7 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS) TEST bits_test_2 SOURCES BitsTest.cpp TEST bitvector_test SOURCES BitVectorCodingTest.cpp TEST dynamic_parser_test SOURCES DynamicParserTest.cpp - TEST eliasfano_test SOURCES EliasFanoCodingTest.cpp + TEST eliasfano_test APPLE_DISABLED SOURCES EliasFanoCodingTest.cpp TEST event_count_test SOURCES EventCountTest.cpp # FunctionSchedulerTest has a lot of timing-dependent checks, # and tends to fail on heavily loaded systems. @@ -993,7 +993,7 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS) TEST atomic_hash_map_test HANGING SOURCES AtomicHashMapTest.cpp TEST atomic_linked_list_test SOURCES AtomicLinkedListTest.cpp - TEST atomic_unordered_map_test SOURCES AtomicUnorderedMapTest.cpp + TEST atomic_unordered_map_test APPLE_DISABLED SOURCES AtomicUnorderedMapTest.cpp TEST base64_test SOURCES base64_test.cpp TEST clock_gettime_wrappers_test SOURCES ClockGettimeWrappersTest.cpp TEST concurrent_bit_set_test SOURCES ConcurrentBitSetTest.cpp @@ -1005,7 +1005,7 @@ if (BUILD_TESTS OR BUILD_BENCHMARKS) TEST cpu_id_test SOURCES CpuIdTest.cpp TEST demangle_test SOURCES DemangleTest.cpp TEST deterministic_schedule_test SOURCES DeterministicScheduleTest.cpp - TEST discriminated_ptr_test SOURCES DiscriminatedPtrTest.cpp + TEST discriminated_ptr_test APPLE_DISABLED SOURCES DiscriminatedPtrTest.cpp TEST dynamic_test SOURCES DynamicTest.cpp TEST dynamic_converter_test SOURCES DynamicConverterTest.cpp TEST dynamic_other_test SOURCES DynamicOtherTest.cpp diff --git folly/ConstexprMath.h folly/ConstexprMath.h index 5df7ae5a6..6fe2b6430 100644 --- folly/ConstexprMath.h +++ folly/ConstexprMath.h @@ -42,15 +42,25 @@ using enable_if_floating_t = /// /// mimic: std::numbers::e_v, C++20 template +#if defined(__ppc__) || defined(__i386__) +FOLLY_INLINE_VARIABLE constexpr T e_v = detail::enable_if_floating_t( + 2.71828182845904523536028747135266250); +#else FOLLY_INLINE_VARIABLE constexpr T e_v = detail::enable_if_floating_t( 2.71828182845904523536028747135266249775724709369995L); +#endif /// ln2_v /// /// mimic: std::numbers::ln2_v, C++20 template +#if defined(__ppc__) || defined(__i386__) +FOLLY_INLINE_VARIABLE constexpr T ln2_v = detail::enable_if_floating_t( + 0.693147180559945309417232121458176568); +#else FOLLY_INLINE_VARIABLE constexpr T ln2_v = detail::enable_if_floating_t( 0.69314718055994530941723212145817656807550013436025L); +#endif /// e /// diff --git folly/DiscriminatedPtr.h folly/DiscriminatedPtr.h index 4284cdf72..582f9a6a7 100644 --- folly/DiscriminatedPtr.h +++ folly/DiscriminatedPtr.h @@ -35,8 +35,8 @@ #include #include -#if !FOLLY_X64 && !FOLLY_AARCH64 && !FOLLY_PPC64 && !FOLLY_RISCV64 -#error "DiscriminatedPtr is x64, arm64, ppc64 and riscv64 specific code." +#if !FOLLY_X64 && !FOLLY_AARCH64 && !FOLLY_PPC && !FOLLY_PPC64 && !FOLLY_RISCV64 +#error "DiscriminatedPtr is x64, arm64, ppc, ppc64 and riscv64 specific code." #endif namespace folly { diff --git folly/File.cpp folly/File.cpp index f61fc3cc7..c5c9966d3 100644 --- folly/File.cpp +++ folly/File.cpp @@ -118,8 +118,10 @@ File File::dupCloseOnExec() const { int fd; #ifdef _WIN32 fd = ::dup(fd_); -#else +#elif defined(F_DUPFD_CLOEXEC) fd = ::fcntl(fd_, F_DUPFD_CLOEXEC, 0); +#else + fd = ::dup(fd_); #endif checkUnixError(fd, "dup() failed"); diff --git folly/Portability.h folly/Portability.h index 5e1c1dee1..b59bb2358 100644 --- folly/Portability.h +++ folly/Portability.h @@ -115,12 +115,18 @@ constexpr bool kHasUnalignedAccess = false; #define FOLLY_AARCH64 0 #endif -#if defined(__powerpc64__) +#if defined(__powerpc64__) || defined(__ppc64__) #define FOLLY_PPC64 1 #else #define FOLLY_PPC64 0 #endif +#if defined(__ppc__) +#define FOLLY_PPC 1 +#else +#define FOLLY_PPC 0 +#endif + #if defined(__s390x__) #define FOLLY_S390X 1 #else @@ -138,6 +144,7 @@ constexpr bool kIsArchArm = FOLLY_ARM == 1; constexpr bool kIsArchAmd64 = FOLLY_X64 == 1; constexpr bool kIsArchAArch64 = FOLLY_AARCH64 == 1; constexpr bool kIsArchPPC64 = FOLLY_PPC64 == 1; +constexpr bool kIsArchPPC = FOLLY_PPC == 1; constexpr bool kIsArchS390X = FOLLY_S390X == 1; constexpr bool kIsArchRISCV64 = FOLLY_RISCV64 == 1; } // namespace folly @@ -302,6 +309,9 @@ constexpr auto kIsLittleEndian = false; #else constexpr auto kIsLittleEndian = true; #endif +#elif defined(__APPLE__) && defined(__POWERPC__) +// Darwin ppc/ppc64 +constexpr auto kIsLittleEndian = false; #else constexpr auto kIsLittleEndian = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__; #endif diff --git folly/Synchronized.h folly/Synchronized.h index d563e4aec..e55eaefbf 100644 --- folly/Synchronized.h +++ folly/Synchronized.h @@ -1510,8 +1510,10 @@ class LockedPtr { SynchronizedType* parent() const { using simulacrum = typename SynchronizedType::Simulacrum; +#ifndef __ppc__ static_assert(sizeof(simulacrum) == sizeof(SynchronizedType), "mismatch"); static_assert(alignof(simulacrum) == alignof(SynchronizedType), "mismatch"); +#endif constexpr auto off = offsetof(simulacrum, mutex_); const auto raw = reinterpret_cast(lock_.mutex()); return reinterpret_cast(raw - (raw ? off : 0)); diff --git folly/detail/base64_detail/Base64SWAR.cpp folly/detail/base64_detail/Base64SWAR.cpp index 72fc4278c..06d0ce4aa 100644 --- folly/detail/base64_detail/Base64SWAR.cpp +++ folly/detail/base64_detail/Base64SWAR.cpp @@ -103,8 +103,13 @@ constexpr auto kBase64SwarDecodeTable = template std::uint32_t base64DecodeSWARMainLoop( const char*& f, const char* l, char*& o) noexcept { + +#ifdef __POWERPC__ + #warning "This code may not work on a Big-endian architecture yet." +#else static_assert( folly::kIsLittleEndian, "Big endian requires a redesigned table"); +#endif std::uint32_t errorAccumulator = 0; diff --git folly/experimental/EliasFanoCoding.h folly/experimental/EliasFanoCoding.h index 03c266d0f..43d90b8a4 100644 --- folly/experimental/EliasFanoCoding.h +++ folly/experimental/EliasFanoCoding.h @@ -42,7 +42,11 @@ namespace folly { namespace compression { -static_assert(kIsLittleEndian, "EliasFanoCoding.h requires little endianness"); +#ifdef __POWERPC__ + #warning "This code may not work on a Big-endian architecture yet." +#else + static_assert(kIsLittleEndian, "EliasFanoCoding.h requires little endianness"); +#endif constexpr size_t kCacheLineSize = 64; diff --git folly/hash/test/ChecksumBenchmark.cpp folly/hash/test/ChecksumBenchmark.cpp index c9a1d7212..1f4061751 100644 --- folly/hash/test/ChecksumBenchmark.cpp +++ folly/hash/test/ChecksumBenchmark.cpp @@ -19,6 +19,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + constexpr size_t kBufSize = 512 * 1024; uint8_t* buf; @@ -58,7 +62,11 @@ int main(int argc, char** argv) { gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + buf = static_cast(malloc(kBufSize + 64)); +#else buf = static_cast(std::aligned_alloc(4096, kBufSize + 64)); +#endif std::default_random_engine rng(1729); // Deterministic seed. std::uniform_int_distribution dist(0, 255); diff --git folly/io/async/AsyncUDPSocket.cpp folly/io/async/AsyncUDPSocket.cpp index d95698cc8..00421573a 100644 --- folly/io/async/AsyncUDPSocket.cpp +++ folly/io/async/AsyncUDPSocket.cpp @@ -262,6 +262,7 @@ void AsyncUDPSocket::init(sa_family_t family, BindOptions bindOptions) { "failed to set IPV6_RECVTCLASS on the socket", errno); } + #ifdef IP_RECVTOS } else if (family == AF_INET) { if (netops::setsockopt( socket, IPPROTO_IP, IP_RECVTOS, &flag, sizeof(flag)) != 0) { @@ -270,6 +271,7 @@ void AsyncUDPSocket::init(sa_family_t family, BindOptions bindOptions) { "failed to set IP_RECVTOS on the socket", errno); } + #endif } } diff --git folly/io/async/fdsock/AsyncFdSocket.h folly/io/async/fdsock/AsyncFdSocket.h index d3d84bb58..8fbfbd9ba 100644 --- folly/io/async/fdsock/AsyncFdSocket.h +++ folly/io/async/fdsock/AsyncFdSocket.h @@ -19,6 +19,16 @@ #include #include +#ifdef __APPLE__ +#include +#if MAC_OS_X_VERSION_MIN_REQUIRED < 110000 +#ifdef __DARWIN_ALIGN32 +#undef __DARWIN_ALIGN32 +#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32) +#endif +#endif +#endif + namespace folly { // Including `gtest/gtest_prod.h` would make gtest/gmock a hard dep diff --git folly/net/NetOps.h folly/net/NetOps.h index 674a216a2..c5881a7d9 100644 --- folly/net/NetOps.h +++ folly/net/NetOps.h @@ -261,6 +261,16 @@ struct mmsghdr { #define F_COPY_CMSG_INT_DATA(cm, val, len) memcpy(CMSG_DATA(cm), val, len) #endif /* _WIN32 */ +#ifndef IPV6_TCLASS +#if defined(__APPLE__) +#define IPV6_TCLASS 36 +#endif +#endif + +#ifndef AI_NUMERICSERV +#define AI_NUMERICSERV 0 +#endif + namespace folly { namespace netops { // Poll descriptor is intended to be byte-for-byte identical to pollfd, diff --git folly/net/TcpInfoTypes.h folly/net/TcpInfoTypes.h index 09a8a9907..d3a6caac4 100644 --- folly/net/TcpInfoTypes.h +++ folly/net/TcpInfoTypes.h @@ -179,7 +179,7 @@ struct tcp_info_legacy { __u32 tcpi_total_retrans; }; -#elif defined(__APPLE__) +#elif defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED > 101003 #define FOLLY_HAVE_TCP_INFO 1 using tcp_info = ::tcp_connection_info; const int tcp_info_sock_opt = TCP_CONNECTION_INFO; diff --git folly/portability/Asm.h folly/portability/Asm.h index e71da91c7..2fdafe6cf 100644 --- folly/portability/Asm.h +++ folly/portability/Asm.h @@ -43,8 +43,12 @@ inline void asm_volatile_pause() { asm volatile("isb"); #elif (defined(__arm__) && !(__ARM_ARCH < 7)) asm volatile("yield"); -#elif FOLLY_PPC64 - asm volatile("or 27,27,27"); +#elif FOLLY_PPC || FOLLY_PPC64 + #ifdef __APPLE__ + __asm__ volatile ("or r27,r27,r27" ::: "memory"); + #else + asm volatile("or 27,27,27"); + #endif #endif } } // namespace folly diff --git folly/portability/Time.cpp folly/portability/Time.cpp index 4039ea814..1351826ea 100644 --- folly/portability/Time.cpp +++ folly/portability/Time.cpp @@ -37,11 +37,13 @@ static void duration_to_ts( #if !FOLLY_HAVE_CLOCK_GETTIME || FOLLY_FORCE_CLOCK_GETTIME_DEFINITION #if __MACH__ #include +#include #include // @manual #include // @manual #include // @manual #include // @manual #include // @manual +#include // for MacOS <= Lion #include // @manual #include // @manual @@ -64,6 +66,7 @@ static int clock_process_cputime(struct timespec* ts) { } // Get CPU usage for terminated threads. +#ifdef MACH_TASK_BASIC_INFO mach_task_basic_info task_basic_info; mach_msg_type_number_t task_basic_info_count = MACH_TASK_BASIC_INFO_COUNT; kern_result = task_info( @@ -74,6 +77,18 @@ static int clock_process_cputime(struct timespec* ts) { if (FOLLY_UNLIKELY(kern_result != KERN_SUCCESS)) { return -1; } +#else + task_basic_info task_basic_info; + mach_msg_type_number_t task_basic_info_count = TASK_BASIC_INFO_COUNT; + kern_result = task_info( + mach_task_self(), + TASK_BASIC_INFO, + (thread_info_t)&task_basic_info, + &task_basic_info_count); + if (FOLLY_UNLIKELY(kern_result != KERN_SUCCESS)) { + return -1; + } +#endif auto cputime = time_value_to_ns(thread_times_info.user_time) + time_value_to_ns(thread_times_info.system_time) + @@ -99,6 +114,7 @@ static int clock_thread_cputime(struct timespec* ts) { return 0; } +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED > 101100 FOLLY_ATTR_WEAK int clock_gettime(clockid_t clk_id, struct timespec* ts) { switch (folly::to_underlying(clk_id)) { case CLOCK_REALTIME: { @@ -120,6 +136,7 @@ FOLLY_ATTR_WEAK int clock_gettime(clockid_t clk_id, struct timespec* ts) { return -1; } } +#endif int clock_getres(clockid_t clk_id, struct timespec* ts) { if (clk_id != CLOCK_MONOTONIC) { @@ -190,6 +207,7 @@ extern "C" int clock_getres(clockid_t clock_id, struct timespec* res) { res->tv_nsec = time_t(perSec * kNsPerSec); return 0; } +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED > 101100 case CLOCK_PROCESS_CPUTIME_ID: case CLOCK_THREAD_CPUTIME_ID: { DWORD adj, timeIncrement; @@ -198,12 +216,11 @@ extern "C" int clock_getres(clockid_t clock_id, struct timespec* res) { errno = EINVAL; return -1; } - res->tv_sec = 0; res->tv_nsec = long(timeIncrement * 100); return 0; } - +#endif default: errno = EINVAL; return -1; @@ -236,6 +253,7 @@ extern "C" int clock_gettime(clockid_t clock_id, struct timespec* tp) { duration_to_ts(now, tp); return 0; } +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED > 101100 case CLOCK_PROCESS_CPUTIME_ID: { if (!GetProcessTimes( GetCurrentProcess(), @@ -268,7 +286,7 @@ extern "C" int clock_gettime(clockid_t clock_id, struct timespec* tp) { filetimeToUnsignedNanos(kernalTime) + filetimeToUnsignedNanos(userTime)); } - +#endif default: errno = EINVAL; return -1; diff --git folly/synchronization/AtomicRef.h folly/synchronization/AtomicRef.h index b4408130c..54772a164 100644 --- folly/synchronization/AtomicRef.h +++ folly/synchronization/AtomicRef.h @@ -28,7 +28,9 @@ namespace detail { template struct atomic_ref_base { static_assert(sizeof(T) == sizeof(std::atomic), "size mismatch"); +#ifndef __ppc__ static_assert(alignof(T) == alignof(std::atomic), "alignment mismatch"); +#endif static_assert(is_trivially_copyable_v, "value not trivially-copyable"); explicit atomic_ref_base(T& ref) : ref_(ref) {} @@ -156,9 +158,11 @@ struct make_atomic_ref_t { template < typename T, std::enable_if_t< - is_trivially_copyable_v && sizeof(T) == sizeof(std::atomic) && - alignof(T) == alignof(std::atomic), - int> = 0> + is_trivially_copyable_v && sizeof(T) == sizeof(std::atomic) +#ifndef __ppc__ + && alignof(T) == alignof(std::atomic) +#endif + , int> = 0> atomic_ref operator()(T& ref) const { return atomic_ref{ref}; } diff --git folly/synchronization/NativeSemaphore.h folly/synchronization/NativeSemaphore.h index f894eed63..2d7c195af 100644 --- folly/synchronization/NativeSemaphore.h +++ folly/synchronization/NativeSemaphore.h @@ -20,13 +20,17 @@ #include #include +#if defined(__APPLE__) +#include +#endif + #include #include #include #if defined(_WIN32) -#elif defined(__APPLE__) +#elif defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__) #include // @manual @@ -94,7 +98,7 @@ class NativeSemaphore { HANDLE sem_{INVALID_HANDLE_VALUE}; }; -#elif defined(__APPLE__) +#elif defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED > 1050) && !defined(__ppc__) class NativeSemaphore { public: diff --git folly/system/ThreadId.cpp folly/system/ThreadId.cpp index fa365a641..bd3760921 100644 --- folly/system/ThreadId.cpp +++ folly/system/ThreadId.cpp @@ -40,9 +40,13 @@ namespace detail { uint64_t getOSThreadIDSlow() { #if __APPLE__ - uint64_t tid; - pthread_threadid_np(nullptr, &tid); - return tid; + #ifndef __POWERPC__ + uint64_t tid; + pthread_threadid_np(nullptr, &tid); + return tid; + #else + return 0; + #endif #elif defined(_WIN32) return uint64_t(GetCurrentThreadId()); #elif defined(__FreeBSD__) diff --git folly/system/ThreadName.cpp folly/system/ThreadName.cpp index 6dc5878cc..d61fd49fe 100644 --- folly/system/ThreadName.cpp +++ folly/system/ThreadName.cpp @@ -56,9 +56,9 @@ #define FOLLY_HAS_PTHREAD_SETNAME_NP_THREAD_NAME 0 #endif -#if defined(__APPLE__) -#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ - __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 +#if defined(__APPLE__) && !defined(__POWERPC__) +#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \ + MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // macOS 10.6+ has pthread_setname_np(const char*) (1 param) #define FOLLY_HAS_PTHREAD_SETNAME_NP_NAME 1 #elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \ diff --git folly/test/ConstexprMathTest.cpp folly/test/ConstexprMathTest.cpp index db61e050c..c478fc138 100644 --- folly/test/ConstexprMathTest.cpp +++ folly/test/ConstexprMathTest.cpp @@ -985,10 +985,12 @@ TEST_F(ConstexprMathTest, constexpr_exp_floating) { constexpr auto a = folly::constexpr_exp(3.3); EXPECT_DOUBLE_EQ(std::exp(3.3), a); } +#ifndef __ppc__ { constexpr auto a = folly::constexpr_exp(471.L); EXPECT_DOUBLE_EQ(std::exp(471.L), a); } +#endif { constexpr auto a = folly::constexpr_exp(600.); EXPECT_NE(lim::infinity(), a); diff --git folly/test/IteratorsTest.cpp folly/test/IteratorsTest.cpp index 63195eced..db1235f7e 100644 --- folly/test/IteratorsTest.cpp +++ folly/test/IteratorsTest.cpp @@ -42,7 +42,9 @@ TEST(IteratorsTest, IterFacadeHasCorrectTraits) { static_assert( std::is_same::value, ""); +#ifndef __ppc__ static_assert(std::is_same::value, ""); +#endif } TEST(IteratorsTest, SimpleIteratorFacade) { @@ -85,7 +87,9 @@ TEST(IteratorsTest, IterAdaptorHasCorrectTraits) { static_assert( std::is_same::value, ""); +#ifndef __ppc__ static_assert(std::is_same::value, ""); +#endif } TEST(IteratorsTest, IterAdaptorWithPointer) { diff --git folly/test/MemsetBenchmark.cpp folly/test/MemsetBenchmark.cpp index 139987d0d..62423f925 100644 --- folly/test/MemsetBenchmark.cpp +++ folly/test/MemsetBenchmark.cpp @@ -25,6 +25,10 @@ #include #include +#ifdef __APPLE__ +#include +#endif + DEFINE_uint32(min_size, 1, "Minimum size to benchmark"); DEFINE_uint32(max_size, 32768, "Maximum size to benchmark"); DEFINE_bool(linear, false, "Test all sizes [min_size, max_size]"); @@ -86,7 +90,11 @@ int main(int argc, char** argv) { assert(FLAGS_step > 0); size_t totalBufSize = (FLAGS_max_size + FLAGS_page_offset + 4095) & ~4095; +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + temp_buf = (uint8_t*)malloc(totalBufSize); +#else temp_buf = (uint8_t*)aligned_alloc(4096, totalBufSize); +#endif // Make sure all pages are allocated for (size_t i = 0; i < totalBufSize; i++) { temp_buf[i] = 0; diff --git folly/test/MemsetTest.cpp folly/test/MemsetTest.cpp index b1deaca05..b65b53acd 100644 --- folly/test/MemsetTest.cpp +++ folly/test/MemsetTest.cpp @@ -21,6 +21,10 @@ #include +#ifdef __APPLE__ +#include +#endif + constexpr size_t kPageSize = 4096; constexpr uint8_t kBufEnd = 0xDB; @@ -45,8 +49,13 @@ void testMemsetImpl(uint8_t* buf, size_t maxLen) { TEST(MemsetAsmTest, alignedBuffer) { constexpr size_t kMaxSize = 2 * kPageSize; +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + uint8_t* buf = reinterpret_cast( + malloc(kMaxSize + 2 * kPageSize)); +#else uint8_t* buf = reinterpret_cast( aligned_alloc(kPageSize, kMaxSize + 2 * kPageSize)); +#endif // Get buffer aligned power of 2 from 16 all the way up to a page size for (size_t alignment = 16; alignment <= kPageSize; alignment <<= 1) { testMemsetImpl(buf + (alignment % kPageSize), kMaxSize); @@ -55,8 +64,13 @@ TEST(MemsetAsmTest, alignedBuffer) { } TEST(MemsetAsmTest, unalignedBuffer) { +#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + uint8_t* buf = + reinterpret_cast(malloc(2 * kPageSize)); +#else uint8_t* buf = reinterpret_cast(aligned_alloc(kPageSize, 2 * kPageSize)); +#endif for (size_t alignment = 1; alignment <= 192; alignment++) { testMemsetImpl(buf + alignment, 256); } diff --git folly/test/OptionalTest.cpp folly/test/OptionalTest.cpp index 016b60639..e0123348a 100644 --- folly/test/OptionalTest.cpp +++ folly/test/OptionalTest.cpp @@ -56,9 +56,11 @@ struct NoDefault { } // namespace +#ifndef __ppc__ static_assert(sizeof(Optional) == 2, ""); -static_assert(sizeof(Optional) == 8, ""); static_assert(sizeof(Optional) == 4, ""); +#endif +static_assert(sizeof(Optional) == 8, ""); static_assert(sizeof(Optional) == sizeof(boost::optional), ""); static_assert(sizeof(Optional) == sizeof(boost::optional), ""); static_assert(sizeof(Optional) == sizeof(boost::optional), "");