QSemaphore: Fix futexMultiWaiterBit for 32bit systems

We don't actually need it in that case, but as the code that uses it is
disabled by a constant expression we cannot disable the variable itself
by a macro. The static_cast makes sure the compiler does not complain
about implicitly casting a 64bit value to a 32bit one.

 thread/qsemaphore.cpp:156:59: error: large integer implicitly truncated to unsigned type [-Werror=overflow]

Task-number: QTBUG-64261
Change-Id: I96f53e28b290e57033737b4f994f8af5b5666587
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Ulf Hermann 2017-10-27 10:46:00 +02:00 committed by Liang Qi
parent 365a41ce25
commit 5418c8764f

View File

@ -153,7 +153,8 @@ static QBasicAtomicInteger<quint32> *futexLow32(QBasicAtomicInteger<quintptr> *p
}
#ifdef FUTEX_OP
static const quintptr futexMultiWaiterBit = Q_UINT64_C(1) << 63;
// quintptr might be 32bit, in which case we want this to be 0, without implicitly casting.
static const quintptr futexMultiWaiterBit = static_cast<quintptr>(Q_UINT64_C(1) << 63);
static QBasicAtomicInteger<quint32> *futexHigh32(QBasicAtomicInteger<quintptr> *ptr)
{
auto result = reinterpret_cast<QBasicAtomicInteger<quint32> *>(ptr);