diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2021-06-30 11:25:46 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2021-07-01 06:44:30 +0200 |
commit | eea930b4d7cabb6ada6155b66b5b143b73a10344 (patch) | |
tree | ba4929b2d134e601bcd693e14f8b6aaa680b0eb2 /src/testlib | |
parent | da914a7d47971a67423318f68260602799e9aa4a (diff) |
QTest: fix -Wformat-overflow GCC warning
Says GCC:
In function ‘char* QTest::toString(QPair<T1, T2>&) [with T1 = QWidget*; T2 = QEvent::Type]’,
warning: ‘%s’ directive argument is null [-Wformat-overflow=]
Fix by re-using formatString(), once introduced for std::tuple.
As a side-effect, this gets rid of the funny double-quotes around the
output.
Change-Id: I2dd5f10fa2b3a392370bf487c1b7e98f3d190978
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qtest.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 4bf5e018a7..cee01e7217 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -380,7 +380,7 @@ inline char *toString(const std::pair<T1, T2> &pair) { const QScopedArrayPointer<char> first(toString(pair.first)); const QScopedArrayPointer<char> second(toString(pair.second)); - return toString(QString::asprintf("std::pair(%s,%s)", first.data(), second.data())); + return formatString("std::pair(", ")", 2, first.data(), second.data()); } template <typename Tuple, int... I> |