Skip to content

Commit 6f57c62

Browse files
authored
Merge pull request #223 from slumber/slumber/clang-warnings
Fixed clang warnings.
2 parents b9b4aa8 + 258cbd4 commit 6f57c62

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

concurrentqueue.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,7 @@ class ConcurrentQueue
16881688
{
16891689
}
16901690

1691-
virtual ~ProducerBase() { };
1691+
virtual ~ProducerBase() { }
16921692

16931693
template<typename U>
16941694
inline bool dequeue(U& element)
@@ -1897,7 +1897,7 @@ class ConcurrentQueue
18971897
++pr_blockIndexSlotsUsed;
18981898
}
18991899

1900-
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new ((T*)nullptr) T(std::forward<U>(element)))) {
1900+
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new (static_cast<T*>(nullptr)) T(std::forward<U>(element)))) {
19011901
// The constructor may throw. We want the element not to appear in the queue in
19021902
// that case (without corrupting the queue):
19031903
MOODYCAMEL_TRY {
@@ -1923,7 +1923,7 @@ class ConcurrentQueue
19231923
blockIndex.load(std::memory_order_relaxed)->front.store(pr_blockIndexFront, std::memory_order_release);
19241924
pr_blockIndexFront = (pr_blockIndexFront + 1) & (pr_blockIndexSize - 1);
19251925

1926-
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new ((T*)nullptr) T(std::forward<U>(element)))) {
1926+
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new (static_cast<T*>(nullptr)) T(std::forward<U>(element)))) {
19271927
this->tailIndex.store(newTailIndex, std::memory_order_release);
19281928
return true;
19291929
}
@@ -2139,7 +2139,7 @@ class ConcurrentQueue
21392139
block = block->next;
21402140
}
21412141

2142-
MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new ((T*)nullptr) T(details::deref_noexcept(itemFirst)))) {
2142+
MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))) {
21432143
blockIndex.load(std::memory_order_relaxed)->front.store((pr_blockIndexFront - 1) & (pr_blockIndexSize - 1), std::memory_order_release);
21442144
}
21452145
}
@@ -2158,7 +2158,7 @@ class ConcurrentQueue
21582158
if (details::circular_less_than<index_t>(newTailIndex, stopIndex)) {
21592159
stopIndex = newTailIndex;
21602160
}
2161-
MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new ((T*)nullptr) T(details::deref_noexcept(itemFirst)))) {
2161+
MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))) {
21622162
while (currentTailIndex != stopIndex) {
21632163
new ((*this->tailBlock)[currentTailIndex++]) T(*itemFirst++);
21642164
}
@@ -2173,7 +2173,7 @@ class ConcurrentQueue
21732173
// may only define a (noexcept) move constructor, and so calls to the
21742174
// cctor will not compile, even if they are in an if branch that will never
21752175
// be executed
2176-
new ((*this->tailBlock)[currentTailIndex]) T(details::nomove_if<(bool)!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new ((T*)nullptr) T(details::deref_noexcept(itemFirst)))>::eval(*itemFirst));
2176+
new ((*this->tailBlock)[currentTailIndex]) T(details::nomove_if<!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))>::eval(*itemFirst));
21772177
++currentTailIndex;
21782178
++itemFirst;
21792179
}
@@ -2220,7 +2220,7 @@ class ConcurrentQueue
22202220
this->tailBlock = this->tailBlock->next;
22212221
}
22222222

2223-
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new ((T*)nullptr) T(details::deref_noexcept(itemFirst)))) {
2223+
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))) {
22242224
if (firstAllocatedBlock != nullptr)
22252225
blockIndex.load(std::memory_order_relaxed)->front.store((pr_blockIndexFront - 1) & (pr_blockIndexSize - 1), std::memory_order_release);
22262226
}
@@ -2239,7 +2239,7 @@ class ConcurrentQueue
22392239
desiredCount = desiredCount < max ? desiredCount : max;
22402240
std::atomic_thread_fence(std::memory_order_acquire);
22412241

2242-
auto myDequeueCount = this->dequeueOptimisticCount.fetch_add(desiredCount, std::memory_order_relaxed);;
2242+
auto myDequeueCount = this->dequeueOptimisticCount.fetch_add(desiredCount, std::memory_order_relaxed);
22432243

22442244
tail = this->tailIndex.load(std::memory_order_acquire);
22452245
auto actualCount = static_cast<size_t>(tail - (myDequeueCount - overcommit));
@@ -2501,7 +2501,7 @@ class ConcurrentQueue
25012501
#endif
25022502
newBlock->ConcurrentQueue::Block::template reset_empty<implicit_context>();
25032503

2504-
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new ((T*)nullptr) T(std::forward<U>(element)))) {
2504+
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new (static_cast<T*>(nullptr)) T(std::forward<U>(element)))) {
25052505
// May throw, try to insert now before we publish the fact that we have this new block
25062506
MOODYCAMEL_TRY {
25072507
new ((*newBlock)[currentTailIndex]) T(std::forward<U>(element));
@@ -2519,7 +2519,7 @@ class ConcurrentQueue
25192519

25202520
this->tailBlock = newBlock;
25212521

2522-
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new ((T*)nullptr) T(std::forward<U>(element)))) {
2522+
MOODYCAMEL_CONSTEXPR_IF (!MOODYCAMEL_NOEXCEPT_CTOR(T, U, new (static_cast<T*>(nullptr)) T(std::forward<U>(element)))) {
25232523
this->tailIndex.store(newTailIndex, std::memory_order_release);
25242524
return true;
25252525
}
@@ -2697,15 +2697,15 @@ class ConcurrentQueue
26972697
if (details::circular_less_than<index_t>(newTailIndex, stopIndex)) {
26982698
stopIndex = newTailIndex;
26992699
}
2700-
MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new ((T*)nullptr) T(details::deref_noexcept(itemFirst)))) {
2700+
MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))) {
27012701
while (currentTailIndex != stopIndex) {
27022702
new ((*this->tailBlock)[currentTailIndex++]) T(*itemFirst++);
27032703
}
27042704
}
27052705
else {
27062706
MOODYCAMEL_TRY {
27072707
while (currentTailIndex != stopIndex) {
2708-
new ((*this->tailBlock)[currentTailIndex]) T(details::nomove_if<(bool)!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new ((T*)nullptr) T(details::deref_noexcept(itemFirst)))>::eval(*itemFirst));
2708+
new ((*this->tailBlock)[currentTailIndex]) T(details::nomove_if<!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))>::eval(*itemFirst));
27092709
++currentTailIndex;
27102710
++itemFirst;
27112711
}
@@ -3459,7 +3459,7 @@ class ConcurrentQueue
34593459
}
34603460

34613461
auto newHash = new (raw) ImplicitProducerHash;
3462-
newHash->capacity = (size_t)newCapacity;
3462+
newHash->capacity = static_cast<size_t>(newCapacity);
34633463
newHash->entries = reinterpret_cast<ImplicitProducerKVP*>(details::align_for<ImplicitProducerKVP>(raw + sizeof(ImplicitProducerHash)));
34643464
for (size_t i = 0; i != newCapacity; ++i) {
34653465
new (newHash->entries + i) ImplicitProducerKVP;
@@ -3698,15 +3698,15 @@ ConsumerToken::ConsumerToken(ConcurrentQueue<T, Traits>& queue)
36983698
: itemsConsumedFromCurrent(0), currentProducer(nullptr), desiredProducer(nullptr)
36993699
{
37003700
initialOffset = queue.nextExplicitConsumerId.fetch_add(1, std::memory_order_release);
3701-
lastKnownGlobalOffset = (std::uint32_t)-1;
3701+
lastKnownGlobalOffset = static_cast<std::uint32_t>(-1);
37023702
}
37033703

37043704
template<typename T, typename Traits>
37053705
ConsumerToken::ConsumerToken(BlockingConcurrentQueue<T, Traits>& queue)
37063706
: itemsConsumedFromCurrent(0), currentProducer(nullptr), desiredProducer(nullptr)
37073707
{
37083708
initialOffset = reinterpret_cast<ConcurrentQueue<T, Traits>*>(&queue)->nextExplicitConsumerId.fetch_add(1, std::memory_order_release);
3709-
lastKnownGlobalOffset = (std::uint32_t)-1;
3709+
lastKnownGlobalOffset = static_cast<std::uint32_t>(-1);
37103710
}
37113711

37123712
template<typename T, typename Traits>

0 commit comments

Comments
 (0)