aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-06-01 11:46:28 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-06-02 02:42:51 +0200
commit130eafa75bed2c4f0c72e2f4e4402b86837e153f (patch)
treee8ff9ea52b75b3d84f3920246a27c335cfe3f5c0 /tools
parent9264899b72776961f891ed5ebb058b5c2494cc14 (diff)
GCC std::optional whack-a-mole [2/N]: qmlls
This is a patch in a series (of as of yet unknown length) to fix GCC's -Werror={maybe-,}uninitialized relating to std::optional use. In this case, using reset() instead of moving from a default-constructed optional fixes the following warning-as-error: In function ‘constexpr std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = QDateTime::ShortData]’, inlined from ‘void QDateTime::Data::swap(QDateTime::Data&)’ at qt5/qtbase/src/corelib/time/qdatetime.h:296:20, inlined from ‘void QDateTime::swap(QDateTime&)’ at qt5/qtbase/src/corelib/time/qdatetime.h:321:50, inlined from ‘QDateTime& QDateTime::operator=(QDateTime&&)’ at qt5/qtbase/src/corelib/time/qdatetime.h:318:5, inlined from ‘constexpr void std::_Optional_payload_base<_Tp>::_M_move_assign(std::_Optional_payload_base<_Tp>&&) [with _Tp = QDateTime]’ at /d/gcc/12/include/c++/12.1.1/optional:194:19, inlined from ‘constexpr void std::_Optional_payload_base<_Tp>::_M_move_assign(std::_Optional_payload_base<_Tp>&&) [with _Tp = QDateTime]’ at /d/gcc/12/include/c++/12.1.1/optional:189:7, inlined from ‘constexpr std::_Optional_payload<_Tp, true, false, false>& std::_Optional_payload<_Tp, true, false, false>::operator=(std::_Optional_payload<_Tp, true, false, false>&&) [with _Tp = QDateTime]’ at /d/gcc/12/include/c++/12.1.1/optional:420:22, inlined from ‘constexpr std::_Optional_payload<_Tp, false, _Copy, _Move>& std::_Optional_payload<_Tp, false, _Copy, _Move>::operator=(std::_Optional_payload<_Tp, false, _Copy, _Move>&&) [with _Tp = QDateTime; bool _Copy = false; bool _Move = false]’ at /d/gcc/12/include/c++/12.1.1/optional:436:26, inlined from ‘constexpr std::_Optional_base<_Tp, <anonymous>, <anonymous> >& std::_Optional_base<_Tp, <anonymous>, <anonymous> >::operator=(std::_Optional_base<_Tp, <anonymous>, <anonymous> >&&) [with _Tp = QDateTime; bool <anonymous> = false; bool <anonymous> = false]’ at /d/gcc/12/include/c++/12.1.1/optional:550:23, inlined from ‘constexpr std::optional<QDateTime>& std::optional<QDateTime>::operator=(std::optional<QDateTime>&&)’ at /d/gcc/12/include/c++/12.1.1/optional:705:11, inlined from ‘void QmlLsp::QmlLintSuggestions::diagnose(const QByteArray&)’ at qtdeclarative/tools/qmlls/qmllintsuggestions.cpp:166:47: /d/gcc/12/include/c++/12.1.1/bits/move.h:205:7: error: ‘*(QDateTime::ShortData*)((char*)&<unnamed> + offsetof(std::optional<QDateTime>,std::optional<QDateTime>::<unnamed>.std::_Optional_base<QDateTime, false, false>::<unnamed>))’ may be used uninitialized [-Werror=maybe-uninitialized] 205 | __a = _GLIBCXX_MOVE(__b); | ^~~ qtdeclarative/tools/qmlls/qmllintsuggestions.cpp: In member function ‘void QmlLsp::QmlLintSuggestions::diagnose(const QByteArray&)’: qtdeclarative/tools/qmlls/qmllintsuggestions.cpp:166:47: note: ‘<anonymous>’ declared here 166 | lastUpdate.invalidUpdatesSince = {}; | ^ cc1plus: all warnings being treated as errors Upstream bug reports: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635 - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86465 - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100115 - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102801 - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105749 IOW: they don't seem to care much. New code in 6.4, so no pick-to. Task-number: QTBUG-103924 Change-Id: Icd2a106bd43eb5597fd9087ef8a324b8027e3180 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlls/qmllintsuggestions.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/qmlls/qmllintsuggestions.cpp b/tools/qmlls/qmllintsuggestions.cpp
index 26b42d97fd..5b0f57f41f 100644
--- a/tools/qmlls/qmllintsuggestions.cpp
+++ b/tools/qmlls/qmllintsuggestions.cpp
@@ -163,7 +163,7 @@ void QmlLintSuggestions::diagnose(const QByteArray &url)
// update immediately, and do not keep track of sent version, thus in extreme cases sent
// updates could be out of sync
lastUpdate.version = version;
- lastUpdate.invalidUpdatesSince = {};
+ lastUpdate.invalidUpdatesSince.reset();
}
}
QString fileContents;