Skip to content

Commit 3a4ee47

Browse files
committed
Suppress Clang dlmalloc compiler warnings
Change-Id: I52635d8682c2651068bc4bd003c078c4cc711beb
1 parent f90fa49 commit 3a4ee47

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

cpp/src/plasma/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,15 @@ ADD_ARROW_LIB(plasma
8787

8888
# The optimization flag -O3 is suggested by dlmalloc.c, which is #included in
8989
# malloc.cc; we set it here regardless of whether we do a debug or release build.
90-
set_source_files_properties(malloc.cc PROPERTIES COMPILE_FLAGS "-Wno-error -O3")
90+
set_source_files_properties(malloc.cc PROPERTIES
91+
COMPILE_FLAGS "-Wno-error -O3")
92+
93+
if ("${COMPILER_FAMILY}" STREQUAL "clang")
94+
set_property(SOURCE malloc.cc
95+
APPEND_STRING
96+
PROPERTY COMPILE_FLAGS
97+
" -Wno-parentheses-equality -Wno-shorten-64-to-32")
98+
endif()
9199

92100
add_executable(plasma_store store.cc)
93101
target_link_libraries(plasma_store plasma_static)

cpp/src/plasma/thirdparty/dlmalloc.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,21 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
584584
/* The maximum possible size_t value has all bits set */
585585
#define MAX_SIZE_T (~(size_t)0)
586586

587+
#if (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0)
588+
#define RECURSIVE_LOCKS_ENABLED 1
589+
#else
590+
#define RECURSIVE_LOCKS_ENABLED 0
591+
#endif
592+
593+
#if (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0)
594+
#define SPIN_LOCKS_ENABLED 1
595+
#else
596+
#define SPIN_LOCKS_ENABLED 0
597+
#endif
598+
587599
#ifndef USE_LOCKS /* ensure true if spin or recursive locks set */
588-
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
589-
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
600+
#define USE_LOCKS ((SPIN_LOCKS_ENABLED != 0) || \
601+
(RECURSIVE_LOCKS_ENABLED != 0))
590602
#endif /* USE_LOCKS */
591603

592604
#if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */
@@ -645,7 +657,9 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP
645657
#ifndef HAVE_MREMAP
646658
#ifdef linux
647659
#define HAVE_MREMAP 1
660+
#ifndef _GNU_SOURCE
648661
#define _GNU_SOURCE /* Turns on mremap() definition */
662+
#endif /* _GNU_SOURCE */
649663
#else /* linux */
650664
#define HAVE_MREMAP 0
651665
#endif /* linux */

0 commit comments

Comments
 (0)