diff --git a/cpp/src/plasma/CMakeLists.txt b/cpp/src/plasma/CMakeLists.txt index 8bb7e71fdf1..7e91202623e 100644 --- a/cpp/src/plasma/CMakeLists.txt +++ b/cpp/src/plasma/CMakeLists.txt @@ -87,7 +87,22 @@ ADD_ARROW_LIB(plasma # The optimization flag -O3 is suggested by dlmalloc.c, which is #included in # malloc.cc; we set it here regardless of whether we do a debug or release build. -set_source_files_properties(malloc.cc PROPERTIES COMPILE_FLAGS "-Wno-error -O3") +set_source_files_properties(malloc.cc PROPERTIES + COMPILE_FLAGS "-O3") + +if ("${COMPILER_FAMILY}" STREQUAL "clang") + set_property(SOURCE malloc.cc + APPEND_STRING + PROPERTY COMPILE_FLAGS + " -Wno-parentheses-equality -Wno-shorten-64-to-32") +endif() + +if ("${COMPILER_FAMILY}" STREQUAL "gcc") + set_property(SOURCE malloc.cc + APPEND_STRING + PROPERTY COMPILE_FLAGS + " -Wno-conversion") +endif() add_executable(plasma_store store.cc) target_link_libraries(plasma_store plasma_static) diff --git a/cpp/src/plasma/thirdparty/dlmalloc.c b/cpp/src/plasma/thirdparty/dlmalloc.c index 84ccbd28fc4..7f3fd639649 100644 --- a/cpp/src/plasma/thirdparty/dlmalloc.c +++ b/cpp/src/plasma/thirdparty/dlmalloc.c @@ -521,6 +521,7 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP improvement at the expense of carrying around more memory. */ + /* Version identifier to allow people to support multiple versions */ #ifndef DLMALLOC_VERSION #define DLMALLOC_VERSION 20806 @@ -584,9 +585,21 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP /* The maximum possible size_t value has all bits set */ #define MAX_SIZE_T (~(size_t)0) +#if (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0) +#define RECURSIVE_LOCKS_ENABLED 1 +#else +#define RECURSIVE_LOCKS_ENABLED 0 +#endif + +#if (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0) +#define SPIN_LOCKS_ENABLED 1 +#else +#define SPIN_LOCKS_ENABLED 0 +#endif + #ifndef USE_LOCKS /* ensure true if spin or recursive locks set */ -#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \ - (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0)) +#define USE_LOCKS ((SPIN_LOCKS_ENABLED != 0) || \ + (RECURSIVE_LOCKS_ENABLED != 0)) #endif /* USE_LOCKS */ #if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */ @@ -645,7 +658,9 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP #ifndef HAVE_MREMAP #ifdef linux #define HAVE_MREMAP 1 +#ifndef _GNU_SOURCE #define _GNU_SOURCE /* Turns on mremap() definition */ +#endif /* _GNU_SOURCE */ #else /* linux */ #define HAVE_MREMAP 0 #endif /* linux */