Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.0
-
None
Description
There are warnings in qstring.h / qstringbuilder.h about qsizetype to int conversion when compiling with -Wshorten-64-to-32 on iOS, macOS:
agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/src/corelib/global/qendian.h:44: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/qfloat16.h:1: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/global/qfloat16.h:45: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/qmetatype.h:1: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/kernel/qmetatype.h:48: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/qvarlengtharray.h:1: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/tools/qvarlengtharray.h:47: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/qhashfunctions.h:1: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/tools/qhashfunctions.h:44: agent:2020/08/24 09:30:03 build.go:302: In file included from /Users/qt/work/qt/qtbase/build/host/include/QtCore/qstring.h:1: agent:2020/08/24 09:30:03 build.go:302: /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/text/qstring.h:189:99: error: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int' [-Werror,-Wshorten-64-to-32] agent:2020/08/24 09:30:03 build.go:302: return result == QContainerImplHelper::Null ? QLatin1String() : QLatin1String(m_data + p, l); agent:2020/08/24 09:30:03 build.go:302: ~~~~~~~~~~~~~ ^ agent:2020/08/24 09:30:03 build.go:302: /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/text/qstring.h:1103:16: error: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int' [-Werror,-Wshorten-64-to-32] agent:2020/08/24 09:30:03 build.go:302: return QString::toUcs4_helper(reinterpret_cast<const ushort *>(data()), int(size()), agent:2020/08/24 09:30:03 build.go:302: ~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ agent:2020/08/24 09:30:03 build.go:302: /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/text/qstring.h:1337:15: error: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int' [-Werror,-Wshorten-64-to-32] agent:2020/08/24 09:30:03 build.go:302: int len = toUcs4_helper(reinterpret_cast<const ushort *>(constData()), length(), agent:2020/08/24 09:30:03 build.go:302: ~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ agent:2020/08/24 09:30:03 build.go:302: /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/text/qstring.h:1533:65: error: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int' [-Werror,-Wshorten-64-to-32] agent:2020/08/24 09:30:03 build.go:302: { m_string = aString; m_position = 0; m_size = aString?aString->size():0; return *this; } agent:2020/08/24 09:30:03 build.go:302: ~ ~~~~~~~~~^~~~~~ agent:2020/08/24 09:30:03 build.go:302: /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/text/qstring.h:1539:64: error: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int' [-Werror,-Wshorten-64-to-32] agent:2020/08/24 09:30:03 build.go:302: :m_string(aString), m_position(0), m_size(aString?aString->size() : 0){} agent:2020/08/24 09:30:03 build.go:302: ~ ~~~~~~~~~^~~~~~ [...] agent:2020/08/24 09:30:03 build.go:302: /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/text/qstringbuilder.h:259:50: error: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'int' [-Werror,-Wshorten-64-to-32] agent:2020/08/24 09:30:03 build.go:302: static int size(const QString &a) { return a.size(); } agent:2020/08/24 09:30:03 build.go:302: ~~~~~~ ~~^~~~~~ agent:2020/08/24 09:30:03 build.go:302: /Users/qt/work/qt/qtbase/build/host/include/QtCore/../../../../src/corelib/text/qstringbuilder.h:262:25: error: implicit conversion loses integer precision: 'qsizetype' (aka 'long long') to 'const int' [-Werror,-Wshorten-64-to-32] agent:2020/08/24 09:30:03 build.go:302: const int n = a.size();
Should these conversions be made explicit, or do should we remove the check from headersclean?
Attachments
Issue Links
- is duplicated by
-
QTBUG-89273 Building almost any Qt example for iOS throws a big list of warnings
- Closed
- relates to
-
QTBUG-85944 Implicit conversion in IOS
- Closed
-
QTBUG-105055 -Wshorten-64-to-32 warnings in private headers
- Closed
- resulted from
-
QTBUG-82615 CMake: Add support for "headerclean" check
- Closed