Wes McKinney created ARROW-1258:
-----------------------------------
Summary: [C++] Suppress dlmalloc warnings on Clang
Key: ARROW-1258
URL: https://issues.apache.org/jira/browse/ARROW-1258
Project: Apache Arrow
Issue Type: Improvement
Components: Plasma (C++)
Reporter: Wes McKinney
Fix For: 0.6.0
{code}
In file included from ../src/plasma/malloc.cc:45:
../src/plasma/thirdparty/dlmalloc.c:592:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
#if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */
^
../src/plasma/thirdparty/dlmalloc.c:588:22: note: expanded from macro
'USE_LOCKS'
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
^
../src/plasma/thirdparty/dlmalloc.c:592:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
../src/plasma/thirdparty/dlmalloc.c:589:22: note: expanded from macro
'USE_LOCKS'
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
^
../src/plasma/thirdparty/dlmalloc.c:648:9: warning: '_GNU_SOURCE' macro
redefined [-Wmacro-redefined]
#define _GNU_SOURCE /* Turns on mremap() definition */
^
<built-in>:341:9: note: previous definition is here
#define _GNU_SOURCE 1
^
In file included from ../src/plasma/malloc.cc:45:
../src/plasma/thirdparty/dlmalloc.c:1492:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
#if USE_LOCKS
^
../src/plasma/thirdparty/dlmalloc.c:588:22: note: expanded from macro
'USE_LOCKS'
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
^
../src/plasma/thirdparty/dlmalloc.c:1492:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
../src/plasma/thirdparty/dlmalloc.c:589:22: note: expanded from macro
'USE_LOCKS'
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
^
../src/plasma/thirdparty/dlmalloc.c:1802:6: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
#if !USE_LOCKS
^
../src/plasma/thirdparty/dlmalloc.c:588:22: note: expanded from macro
'USE_LOCKS'
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
^
../src/plasma/thirdparty/dlmalloc.c:1802:6: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
../src/plasma/thirdparty/dlmalloc.c:589:22: note: expanded from macro
'USE_LOCKS'
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
^
../src/plasma/thirdparty/dlmalloc.c:2594:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
#if USE_LOCKS
^
../src/plasma/thirdparty/dlmalloc.c:588:22: note: expanded from macro
'USE_LOCKS'
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
^
../src/plasma/thirdparty/dlmalloc.c:2594:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
../src/plasma/thirdparty/dlmalloc.c:589:22: note: expanded from macro
'USE_LOCKS'
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
^
../src/plasma/thirdparty/dlmalloc.c:2644:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
#if USE_LOCKS
^
../src/plasma/thirdparty/dlmalloc.c:588:22: note: expanded from macro
'USE_LOCKS'
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
^
../src/plasma/thirdparty/dlmalloc.c:2644:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
../src/plasma/thirdparty/dlmalloc.c:589:22: note: expanded from macro
'USE_LOCKS'
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
^
../src/plasma/thirdparty/dlmalloc.c:2740:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
#if USE_LOCKS
^
../src/plasma/thirdparty/dlmalloc.c:588:22: note: expanded from macro
'USE_LOCKS'
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
^
../src/plasma/thirdparty/dlmalloc.c:2740:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
../src/plasma/thirdparty/dlmalloc.c:589:22: note: expanded from macro
'USE_LOCKS'
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
^
../src/plasma/thirdparty/dlmalloc.c:4563:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
#if USE_LOCKS
^
../src/plasma/thirdparty/dlmalloc.c:588:22: note: expanded from macro
'USE_LOCKS'
#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \
^
../src/plasma/thirdparty/dlmalloc.c:4563:5: warning: macro expansion producing
'defined' has undefined behavior [-Wexpansion-to-defined]
../src/plasma/thirdparty/dlmalloc.c:589:22: note: expanded from macro
'USE_LOCKS'
(defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0))
^
15 warnings generated.
In file included from ../src/plasma/malloc.cc:45:
../src/plasma/thirdparty/dlmalloc.c:3968:853: warning: implicit conversion
loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int'
[-Wshorten-64-to-32]
if ((((qsize) >> (3U)) < (32U))) { bindex_t I = (bindex_t)((qsize) >>
(3U)); mchunkptr B = ((sbinptr)((char*)&((m)->smallbins[(I)<<1]))); mchunkptr F
= B; ((qsize >= (((sizeof(mchunk)) + (((size_t)(2 * sizeof(void *))) -
((size_t)1))) & ~(((size_t)(2 * sizeof(void *))) - ((size_t)1)))) ?
static_cast<void> (0) : __assert_fail ("qsize >= (((sizeof(mchunk)) +
(((size_t)(2 * sizeof(void *))) - ((size_t)1))) & ~(((size_t)(2 * sizeof(void
*))) - ((size_t)1)))", "../src/plasma/thirdparty/dlmalloc.c", 3968,
__PRETTY_FUNCTION__)); if (!((m)->smallmap & ((binmap_t)(1) << (I))))
((m)->smallmap |= ((binmap_t)(1) << (I))); else if
(__builtin_expect(((char*)(B->fd) >= (m)->least_addr), 1)) F = B->fd; else {
abort(); } B->fd = q; F->bk = q; q->fd = F; q->bk = B;} else { tchunkptr TP =
(tchunkptr)(q); { tbinptr* H; bindex_t I; { unsigned int X = qsize >> (8U); if
(X == 0) I = 0; else if (X > 0xFFFF) I = (32U)-1; else { unsigned int K =
(unsigned) sizeof(X)*8 - 1 - (unsigned) __builtin_clz(X); I = (bindex_t)((K <<
1) + ((qsize >> (K + ((8U)-1)) & 1))); }}; H = (&((m)->treebins[I])); TP->index
= I; TP->child[0] = TP->child[1] = 0; if (!((m)->treemap & ((binmap_t)(1) <<
(I)))) { ((m)->treemap |= ((binmap_t)(1) << (I))); *H = TP; TP->parent =
(tchunkptr)H; TP->fd = TP->bk = TP; } else { tchunkptr T = *H; size_t K = qsize
<< ((I == (32U)-1)? 0 : (((sizeof(size_t) << 3)-((size_t)1)) - (((I) >> 1) +
(8U) - 2))); for (;;) { if (((T)->head &
~(((((size_t)1))|(((size_t)2))|(((size_t)4))))) != qsize) { tchunkptr* C =
&(T->child[(K >> ((sizeof(size_t) << 3)-((size_t)1))) & 1]); K <<= 1; if (*C !=
0) T = *C; else if (__builtin_expect(((char*)(C) >= (m)->least_addr), 1)) { *C
= TP; TP->parent = T; TP->fd = TP->bk = TP; break; } else { abort(); break; } }
else { tchunkptr F = T->fd; if (__builtin_expect(((char*)(T) >=
(m)->least_addr) && ((char*)(F) >= (m)->least_addr), 1)) { T->fd = F->bk = TP;
TP->fd = F; TP->bk = T; TP->parent = 0; break; } else { abort(); break; } } }
}}; };
~ ~~~~~~^~~~~~~
../src/plasma/thirdparty/dlmalloc.c:4023:853: warning: implicit conversion
loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int'
[-Wshorten-64-to-32]
if ((((psize) >> (3U)) < (32U))) { bindex_t I = (bindex_t)((psize) >>
(3U)); mchunkptr B = ((sbinptr)((char*)&((m)->smallbins[(I)<<1]))); mchunkptr F
= B; ((psize >= (((sizeof(mchunk)) + (((size_t)(2 * sizeof(void *))) -
((size_t)1))) & ~(((size_t)(2 * sizeof(void *))) - ((size_t)1)))) ?
static_cast<void> (0) : __assert_fail ("psize >= (((sizeof(mchunk)) +
(((size_t)(2 * sizeof(void *))) - ((size_t)1))) & ~(((size_t)(2 * sizeof(void
*))) - ((size_t)1)))", "../src/plasma/thirdparty/dlmalloc.c", 4023,
__PRETTY_FUNCTION__)); if (!((m)->smallmap & ((binmap_t)(1) << (I))))
((m)->smallmap |= ((binmap_t)(1) << (I))); else if
(__builtin_expect(((char*)(B->fd) >= (m)->least_addr), 1)) F = B->fd; else {
abort(); } B->fd = q; F->bk = q; q->fd = F; q->bk = B;} else { tchunkptr TP =
(tchunkptr)(q); { tbinptr* H; bindex_t I; { unsigned int X = psize >> (8U); if
(X == 0) I = 0; else if (X > 0xFFFF) I = (32U)-1; else { unsigned int K =
(unsigned) sizeof(X)*8 - 1 - (unsigned) __builtin_clz(X); I = (bindex_t)((K <<
1) + ((psize >> (K + ((8U)-1)) & 1))); }}; H = (&((m)->treebins[I])); TP->index
= I; TP->child[0] = TP->child[1] = 0; if (!((m)->treemap & ((binmap_t)(1) <<
(I)))) { ((m)->treemap |= ((binmap_t)(1) << (I))); *H = TP; TP->parent =
(tchunkptr)H; TP->fd = TP->bk = TP; } else { tchunkptr T = *H; size_t K = psize
<< ((I == (32U)-1)? 0 : (((sizeof(size_t) << 3)-((size_t)1)) - (((I) >> 1) +
(8U) - 2))); for (;;) { if (((T)->head &
~(((((size_t)1))|(((size_t)2))|(((size_t)4))))) != psize) { tchunkptr* C =
&(T->child[(K >> ((sizeof(size_t) << 3)-((size_t)1))) & 1]); K <<= 1; if (*C !=
0) T = *C; else if (__builtin_expect(((char*)(C) >= (m)->least_addr), 1)) { *C
= TP; TP->parent = T; TP->fd = TP->bk = TP; break; } else { abort(); break; } }
else { tchunkptr F = T->fd; if (__builtin_expect(((char*)(T) >=
(m)->least_addr) && ((char*)(F) >= (m)->least_addr), 1)) { T->fd = F->bk = TP;
TP->fd = F; TP->bk = T; TP->parent = 0; break; } else { abort(); break; } } }
}}; };
~ ~~~~~~^~~~~~~
../src/plasma/thirdparty/dlmalloc.c:4181:16: warning: equality comparison with
extraneous parentheses [-Wparentheses-equality]
if (((m) == &_gm_))
~~~~^~~~~~~~
../src/plasma/thirdparty/dlmalloc.c:4181:16: note: remove extraneous
parentheses around the comparison to silence this warning
if (((m) == &_gm_))
~ ^ ~
../src/plasma/thirdparty/dlmalloc.c:4181:16: note: use '=' to turn this
equality comparison into an assignment
if (((m) == &_gm_))
^~
=
../src/plasma/thirdparty/dlmalloc.c:4275:62: warning: implicit conversion loses
integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int'
[-Wshorten-64-to-32]
{ tbinptr* H; bindex_t I; { unsigned int X = psize >> (8U); if (X ==
0) I = 0; else if (X > 0xFFFF) I = (32U)-1; else { unsigned int K = (unsigned)
sizeof(X)*8 - 1 - (unsigned) __builtin_clz(X); I = (bindex_t)((K << 1) +
((psize >> (K + ((8U)-1)) & 1))); }}; H = (&((m)->treebins[I])); tp->index = I;
tp->child[0] = tp->child[1] = 0; if (!((m)->treemap & ((binmap_t)(1) << (I))))
{ ((m)->treemap |= ((binmap_t)(1) << (I))); *H = tp; tp->parent = (tchunkptr)H;
tp->fd = tp->bk = tp; } else { tchunkptr T = *H; size_t K = psize << ((I ==
(32U)-1)? 0 : (((sizeof(size_t) << 3)-((size_t)1)) - (((I) >> 1) + (8U) - 2)));
for (;;) { if (((T)->head & ~(((((size_t)1))|(((size_t)2))|(((size_t)4))))) !=
psize) { tchunkptr* C = &(T->child[(K >> ((sizeof(size_t) << 3)-((size_t)1))) &
1]); K <<= 1; if (*C != 0) T = *C; else if (__builtin_expect(((char*)(C) >=
(m)->least_addr), 1)) { *C = tp; tp->parent = T; tp->fd = tp->bk = tp; break; }
else { abort(); break; } } else { tchunkptr F = T->fd; if
(__builtin_expect(((char*)(T) >= (m)->least_addr) && ((char*)(F) >=
(m)->least_addr), 1)) { T->fd = F->bk = tp; tp->fd = F; tp->bk = T; tp->parent
= 0; break; } else { abort(); break; } } } }};
~ ~~~~~~^~~~~~~
../src/plasma/thirdparty/dlmalloc.c:4419:853: warning: implicit conversion
loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int'
[-Wshorten-64-to-32]
if ((((psize) >> (3U)) < (32U))) { bindex_t I = (bindex_t)((psize) >>
(3U)); mchunkptr B = ((sbinptr)((char*)&((m)->smallbins[(I)<<1]))); mchunkptr F
= B; ((psize >= (((sizeof(mchunk)) + (((size_t)(2 * sizeof(void *))) -
((size_t)1))) & ~(((size_t)(2 * sizeof(void *))) - ((size_t)1)))) ?
static_cast<void> (0) : __assert_fail ("psize >= (((sizeof(mchunk)) +
(((size_t)(2 * sizeof(void *))) - ((size_t)1))) & ~(((size_t)(2 * sizeof(void
*))) - ((size_t)1)))", "../src/plasma/thirdparty/dlmalloc.c", 4419,
__PRETTY_FUNCTION__)); if (!((m)->smallmap & ((binmap_t)(1) << (I))))
((m)->smallmap |= ((binmap_t)(1) << (I))); else if
(__builtin_expect(((char*)(B->fd) >= (m)->least_addr), 1)) F = B->fd; else {
abort(); } B->fd = p; F->bk = p; p->fd = F; p->bk = B;} else { tchunkptr TP =
(tchunkptr)(p); { tbinptr* H; bindex_t I; { unsigned int X = psize >> (8U); if
(X == 0) I = 0; else if (X > 0xFFFF) I = (32U)-1; else { unsigned int K =
(unsigned) sizeof(X)*8 - 1 - (unsigned) __builtin_clz(X); I = (bindex_t)((K <<
1) + ((psize >> (K + ((8U)-1)) & 1))); }}; H = (&((m)->treebins[I])); TP->index
= I; TP->child[0] = TP->child[1] = 0; if (!((m)->treemap & ((binmap_t)(1) <<
(I)))) { ((m)->treemap |= ((binmap_t)(1) << (I))); *H = TP; TP->parent =
(tchunkptr)H; TP->fd = TP->bk = TP; } else { tchunkptr T = *H; size_t K = psize
<< ((I == (32U)-1)? 0 : (((sizeof(size_t) << 3)-((size_t)1)) - (((I) >> 1) +
(8U) - 2))); for (;;) { if (((T)->head &
~(((((size_t)1))|(((size_t)2))|(((size_t)4))))) != psize) { tchunkptr* C =
&(T->child[(K >> ((sizeof(size_t) << 3)-((size_t)1))) & 1]); K <<= 1; if (*C !=
0) T = *C; else if (__builtin_expect(((char*)(C) >= (m)->least_addr), 1)) { *C
= TP; TP->parent = T; TP->fd = TP->bk = TP; break; } else { abort(); break; } }
else { tchunkptr F = T->fd; if (__builtin_expect(((char*)(T) >=
(m)->least_addr) && ((char*)(F) >= (m)->least_addr), 1)) { T->fd = F->bk = TP;
TP->fd = F; TP->bk = T; TP->parent = 0; break; } else { abort(); break; } } }
}}; };
~ ~~~~~~^~~~~~~
../src/plasma/thirdparty/dlmalloc.c:4434:25: warning: implicit conversion loses
integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int'
[-Wshorten-64-to-32]
{ unsigned int X = nb >> (8U); if (X == 0) idx = 0; else if (X > 0xFFFF) idx
= (32U)-1; else { unsigned int K = (unsigned) sizeof(X)*8 - 1 - (unsigned)
__builtin_clz(X); idx = (bindex_t)((K << 1) + ((nb >> (K + ((8U)-1)) & 1))); }};
~ ~~~^~~~~~~
../src/plasma/thirdparty/dlmalloc.c:4489:859: warning: implicit conversion
loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int'
[-Wshorten-64-to-32]
if ((((rsize) >> (3U)) < (32U))) { bindex_t I = (bindex_t)((rsize) >>
(3U)); mchunkptr B = ((sbinptr)((char*)&((m)->smallbins[(I)<<1]))); mchunkptr F
= B; ((rsize >= (((sizeof(mchunk)) + (((size_t)(2 * sizeof(void *))) -
((size_t)1))) & ~(((size_t)(2 * sizeof(void *))) - ((size_t)1)))) ?
static_cast<void> (0) : __assert_fail ("rsize >= (((sizeof(mchunk)) +
(((size_t)(2 * sizeof(void *))) - ((size_t)1))) & ~(((size_t)(2 * sizeof(void
*))) - ((size_t)1)))", "../src/plasma/thirdparty/dlmalloc.c", 4489,
__PRETTY_FUNCTION__)); if (!((m)->smallmap & ((binmap_t)(1) << (I))))
((m)->smallmap |= ((binmap_t)(1) << (I))); else if
(__builtin_expect(((char*)(B->fd) >= (m)->least_addr), 1)) F = B->fd; else {
abort(); } B->fd = r; F->bk = r; r->fd = F; r->bk = B;} else { tchunkptr TP =
(tchunkptr)(r); { tbinptr* H; bindex_t I; { unsigned int X = rsize >> (8U); if
(X == 0) I = 0; else if (X > 0xFFFF) I = (32U)-1; else { unsigned int K =
(unsigned) sizeof(X)*8 - 1 - (unsigned) __builtin_clz(X); I = (bindex_t)((K <<
1) + ((rsize >> (K + ((8U)-emap & ((binmap_t)(1) << (I)))) { ((m)->treemap |=
((binmap_t)(1) << (I))); *H = TP; TP->parent = (tchunkptr)H; TP->fd = TP->bk =
TP; } else { tchunkptr T = *H; size_t K = rsize << ((I == (32U)-1)? 0 :
(((sizeof(size_t) << 3)-((size_t)1)) - (((I) >> 1) + (8U) - 2))); for (;;) { if
(((T)->head & ~(((((size_t)1))|(((size_t)2))|(((size_t)4))))) != rsize) {
tchunkptr* C = &(T->child[(K >> ((sizeof(size_t) << 3)-((size_t)1))) & 1]); K
<<= 1; if (*C != 0) T = *C; else if (__builtin_expect(((char*)(C) >=
(m)->least_addr), 1)) { *C = TP; TP->parent = T; TP->fd = TP->bk = TP; break; }
else { abort(); break; } } else { tchunkptr F = T->fd; if
(__builtin_expect(((char*)(T) >= (m)->least_addr) && ((char*)(F) >=
(m)->least_addr), 1)) { T->fd = F->bk = TP; TP->fd = F; TP->bk = T; TP->parent
= 0; break; } else { abort(); break; } } } }}; };
~ ~~~~~~^~~~~~~
../src/plasma/thirdparty/dlmalloc.c:4767:64: warning: implicit conversion loses
integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int'
[-Wshorten-64-to-32]
{ tbinptr* H; bindex_t I; { unsigned int X = psize >> (8U); if (X
== 0) I = 0; else if (X > 0xFFFF) I = (32U)-1; else { unsigned int K =
(unsigned) sizeof(X)*8 - 1 - (unsigned) __builtin_clz(X); I = (bindex_t)((K <<
1) + ((psize >> (K + ((8U)-1)) & 1))); }}; H = (&(((&_gm_))->treebins[I]));
tp->index = I; tp->child[0] = tp->child[1] = 0; if (!(((&_gm_))->treemap &
((binmap_t)(1) << (I)))) { (((&_gm_))->treemap |= ((binmap_t)(1) << (I))); *H =
tp; tp->parent = (tchunkptr)H; tp->fd = tp->bk = tp; } else { tchunkptr T = *H;
size_t K = psize << ((I == (32U)-1)? 0 : (((sizeof(size_t) << 3)-((size_t)1)) -
(((I) >> 1) + (8U) - 2))); for (;;) { if (((T)->head &
~(((((size_t)1))|(((size_t)2))|(((size_t)4))))) != psize) { tchunkptr* C =
&(T->child[(K >> ((sizeof(size_t) << 3)-((size_t)1))) & 1]); K <<= 1; if (*C !=
0) T = *C; else if (__builtin_expect(((char*)(C) >= ((&_gm_))->least_addr), 1))
{ *C = tp; tp->parent = T; tp->fd = tp->bk = tp; break; } else { abort();
break; } } else { tchunkptr F = T->fd; if (__builtin_expect(((char*)(T) >=
((&_gm_))->least_addr) && ((char*)(F) >= ((&_gm_))->least_addr), 1)) { T->fd =
F->bk = tp; tp->fd = F; tp->bk = T; tp->parent = 0; break; } else { abort();
break; } } } }};
~ ~~~~~~^~~~~~~
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)