qarraydataops: Fix compiler warnings under MSVC 2019.7
qarraydataops.h(444): warning C4127: conditional expression is constant qarraydataops.h(444): note: consider using 'if constexpr' statement instead ... qabstractitemmodel.h(261): note: see reference to class template instantiation 'QList<int>' being compiled qarraydataops.h(1209) : warning C4702: unreachable code qarraydataops.h(1104): warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used src/corelib/kernel/qobjectdefs_impl.h(96): note: could be 'void QtPrivate::operator ,<std::reverse_iterator<QTypedArrayData<T>::iterator>>(std::reverse_iterator<QTypedArrayData<T>::iterator>,const QtPrivate::ApplyReturnValue<void> &)' with [ T=QTextEdit::ExtraSelection ] qarraydataops.h(1104): note: while trying to match the argument list '(std::reverse_iterator<QTypedArrayData<T>::iterator>, std::reverse_iterator<QTypedArrayData<T>::iterator>)' with [ T=QTextEdit::ExtraSelection ] ... codeedit.cpp(84): note: see reference to class template instantiation 'QList<QTextEdit::ExtraSelection>' being compiled Change-Id: I3c5007e40f709c28bc8b3b3bec5ea98ea5f34e5a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
7e1432898e
commit
2a896becdf
@ -441,16 +441,20 @@ public:
|
|||||||
// only use memcmp for fundamental types or pointers.
|
// only use memcmp for fundamental types or pointers.
|
||||||
// Other types could have padding in the data structure or custom comparison
|
// Other types could have padding in the data structure or custom comparison
|
||||||
// operators that would break the comparison using memcmp
|
// operators that would break the comparison using memcmp
|
||||||
if (QArrayDataPointer<T>::pass_parameter_by_value)
|
if constexpr (QArrayDataPointer<T>::pass_parameter_by_value) {
|
||||||
return ::memcmp(begin1, begin2, n * sizeof(T)) == 0;
|
return ::memcmp(begin1, begin2, n * sizeof(T)) == 0;
|
||||||
const T *end1 = begin1 + n;
|
} else {
|
||||||
while (begin1 != end1) {
|
const T *end1 = begin1 + n;
|
||||||
if (*begin1 == *begin2)
|
while (begin1 != end1) {
|
||||||
++begin1, ++begin2;
|
if (*begin1 == *begin2) {
|
||||||
else
|
++begin1;
|
||||||
return false;
|
++begin2;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reallocate(qsizetype alloc, typename Data::ArrayOptions options)
|
void reallocate(qsizetype alloc, typename Data::ArrayOptions options)
|
||||||
@ -587,12 +591,14 @@ public:
|
|||||||
|
|
||||||
// Copy assign over existing elements
|
// Copy assign over existing elements
|
||||||
while (readIter != where) {
|
while (readIter != where) {
|
||||||
--readIter, --writeIter;
|
--readIter;
|
||||||
|
--writeIter;
|
||||||
*writeIter = *readIter;
|
*writeIter = *readIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (writeIter != where) {
|
while (writeIter != where) {
|
||||||
--e, --writeIter;
|
--e;
|
||||||
|
--writeIter;
|
||||||
*writeIter = *e;
|
*writeIter = *e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -619,12 +625,14 @@ public:
|
|||||||
// Construct new elements in array
|
// Construct new elements in array
|
||||||
while (writeIter != step1End) {
|
while (writeIter != step1End) {
|
||||||
new (writeIter) T(*readIter);
|
new (writeIter) T(*readIter);
|
||||||
++readIter, ++writeIter;
|
++readIter;
|
||||||
|
++writeIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (writeIter != begin) {
|
while (writeIter != begin) {
|
||||||
new (writeIter) T(*b);
|
new (writeIter) T(*b);
|
||||||
++b, ++writeIter;
|
++b;
|
||||||
|
++writeIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
destroyer.commit();
|
destroyer.commit();
|
||||||
@ -634,12 +642,14 @@ public:
|
|||||||
// Copy assign over existing elements
|
// Copy assign over existing elements
|
||||||
while (readIter != where) {
|
while (readIter != where) {
|
||||||
*writeIter = *readIter;
|
*writeIter = *readIter;
|
||||||
++readIter, ++writeIter;
|
++readIter;
|
||||||
|
++writeIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (writeIter != where) {
|
while (writeIter != where) {
|
||||||
*writeIter = *b;
|
*writeIter = *b;
|
||||||
++b, ++writeIter;
|
++b;
|
||||||
|
++writeIter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,12 +693,14 @@ public:
|
|||||||
|
|
||||||
// Copy assign over existing elements
|
// Copy assign over existing elements
|
||||||
while (readIter != where) {
|
while (readIter != where) {
|
||||||
--readIter, --writeIter;
|
--readIter;
|
||||||
|
--writeIter;
|
||||||
*writeIter = *readIter;
|
*writeIter = *readIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (writeIter != where) {
|
while (writeIter != where) {
|
||||||
--n, --writeIter;
|
--n;
|
||||||
|
--writeIter;
|
||||||
*writeIter = t;
|
*writeIter = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -712,7 +724,8 @@ public:
|
|||||||
// Construct new elements in array
|
// Construct new elements in array
|
||||||
while (writeIter != step1End) {
|
while (writeIter != step1End) {
|
||||||
new (writeIter) T(*readIter);
|
new (writeIter) T(*readIter);
|
||||||
++readIter, ++writeIter;
|
++readIter;
|
||||||
|
++writeIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (writeIter != begin) {
|
while (writeIter != begin) {
|
||||||
@ -727,7 +740,8 @@ public:
|
|||||||
// Copy assign over existing elements
|
// Copy assign over existing elements
|
||||||
while (readIter != where) {
|
while (readIter != where) {
|
||||||
*writeIter = *readIter;
|
*writeIter = *readIter;
|
||||||
++readIter, ++writeIter;
|
++readIter;
|
||||||
|
++writeIter;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (writeIter != where) {
|
while (writeIter != where) {
|
||||||
@ -784,7 +798,8 @@ public:
|
|||||||
// onto b to the new end
|
// onto b to the new end
|
||||||
while (e != end) {
|
while (e != end) {
|
||||||
*b = *e;
|
*b = *e;
|
||||||
++b, ++e;
|
++b;
|
||||||
|
++e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy the final elements at the end
|
// destroy the final elements at the end
|
||||||
@ -808,7 +823,8 @@ public:
|
|||||||
// move (by assignment) the elements from begin to b
|
// move (by assignment) the elements from begin to b
|
||||||
// onto the new begin to e
|
// onto the new begin to e
|
||||||
while (b != begin) {
|
while (b != begin) {
|
||||||
--b, --e;
|
--b;
|
||||||
|
--e;
|
||||||
*e = *b;
|
*e = *b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,10 +851,12 @@ public:
|
|||||||
{
|
{
|
||||||
const T *end1 = begin1 + n;
|
const T *end1 = begin1 + n;
|
||||||
while (begin1 != end1) {
|
while (begin1 != end1) {
|
||||||
if (*begin1 == *begin2)
|
if (*begin1 == *begin2) {
|
||||||
++begin1, ++begin2;
|
++begin1;
|
||||||
else
|
++begin2;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1101,7 +1119,8 @@ private:
|
|||||||
// step 2. move assign over existing elements in the overlapping
|
// step 2. move assign over existing elements in the overlapping
|
||||||
// region (if there's an overlap)
|
// region (if there's an overlap)
|
||||||
while (e != begin) {
|
while (e != begin) {
|
||||||
--start, --e;
|
--start;
|
||||||
|
--e;
|
||||||
*start = std::move_if_noexcept(*e);
|
*start = std::move_if_noexcept(*e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,8 +1224,9 @@ private:
|
|||||||
|| std::is_same_v<RemovedConstVolatileIt, const volatile T *>;
|
|| std::is_same_v<RemovedConstVolatileIt, const volatile T *>;
|
||||||
if constexpr (selfIterator) {
|
if constexpr (selfIterator) {
|
||||||
return (first >= this->begin() && last <= this->end());
|
return (first >= this->begin() && last <= this->end());
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const bool inRange = iteratorsInRange(b, e);
|
const bool inRange = iteratorsInRange(b, e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user