Skip to content

Commit b29f111

Browse files
Improve qt.cfg: unreadVariable for macro parameter (danmar#4683)
1 parent 4ebdf5f commit b29f111

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

cfg/qt.cfg

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5179,15 +5179,15 @@
51795179
<define name="QT_TRANSLATE_NOOP3_UTF8(scope, x, comment)" value="{x, comment}"/>
51805180
<define name="QCOMPARE(actual, expected)" value="(void)((actual)==(expected))"/>
51815181
<define name="QVERIFY(condition)" value="(void)(condition)"/>
5182-
<define name="QVERIFY2(condition, message)" value="(void)(condition)"/>
5182+
<define name="QVERIFY2(condition, message)" value="(void)(condition),(void)(message)"/>
51835183
<define name="QBENCHMARK_ONCE" value=""/>
51845184
<define name="QBENCHMARK" value=""/>
51855185
<define name="QTRY_COMPARE(actual, expected)" value="(void)((actual)==(expected))"/>
51865186
<define name="QTRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)" value="(void)((actual)==(expected))"/>
5187-
<define name="QTRY_VERIFY2(condition, message)" value="(void)(condition)"/>
5187+
<define name="QTRY_VERIFY2(condition, message)" value="(void)(condition),(void)(message)"/>
51885188
<define name="QTRY_VERIFY(condition)" value="(void)(condition)"/>
5189-
<define name="QTRY_VERIFY2_WITH_TIMEOUT(condition, message, timeout)" value="(void)(condition)"/>
5190-
<define name="QTRY_VERIFY_WITH_TIMEOUT(condition, timeout)" value="(void)(condition)"/>
5189+
<define name="QTRY_VERIFY2_WITH_TIMEOUT(condition, message, timeout)" value="(void)(condition),(void)(message),(void)(timeout)"/>
5190+
<define name="QTRY_VERIFY_WITH_TIMEOUT(condition, timeout)" value="(void)(condition),(void)(timeout)"/>
51915191
<define name="QTEST_GUILESS_MAIN(testclass)" value=""/>
51925192
<define name="QTEST_APPLESS_MAIN(testclass)" value=""/>
51935193
<define name="QTEST_MAIN(testclass)" value=""/>
@@ -5215,6 +5215,7 @@
52155215
<define name="QT_FORWARD_DECLARE_STRUCT(name)" value="struct name;"/>
52165216
<!-- https://doc.qt.io/qt-5/qstring.html#QStringLiteral -->
52175217
<define name="QStringLiteral(str)" value="QString::fromUtf8(str, sizeof(str) - 1)"/>
5218+
<define name="QByteArrayLiteral(str)" value="QByteArray(str)"/>
52185219
<!-- https://doc.qt.io/qt-5/qtglobal.html#qreal-typedef -->
52195220
<define name="qreal" value="double"/>
52205221
<podtype name="qint8" sign="s" size="1"/>

test/cfg/qt.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <cstdio>
2020
#include <QCoreApplication>
2121
#include <QLoggingCategory>
22+
#include <QTest>
2223

2324

2425
void QString1(QString s)
@@ -412,6 +413,13 @@ void MacroTest2_test()
412413
#endif
413414
}
414415

416+
void MacroTest3()
417+
{
418+
QByteArray message = QByteArrayLiteral("Test1");
419+
message += QByteArrayLiteral("Test2");
420+
QVERIFY2(2 >= 0, message.constData());
421+
}
422+
415423
void validCode(int * pIntPtr, QString & qstrArg)
416424
{
417425
if (QFile::exists("test")) {}

test/cfg/runtests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ CC_OPT='-Wno-format -Wno-stringop-overread -Wno-nonnull -Wno-implicit-function-d
3333

3434
function get_pkg_config_cflags {
3535
set +e
36-
PKGCONFIG=$(pkg-config --cflags $1)
36+
PKGCONFIG=$(pkg-config --cflags "$@")
3737
PKGCONFIG_RETURNCODE=$?
3838
set -e
3939
if [ $PKGCONFIG_RETURNCODE -ne 0 ]; then
@@ -60,9 +60,9 @@ function gnu_fn {
6060
# qt.cpp
6161
function qt_fn {
6262
if [ $HAS_PKG_CONFIG -eq 1 ]; then
63-
QTCONFIG=$(get_pkg_config_cflags Qt5Core)
63+
QTCONFIG=$(get_pkg_config_cflags Qt5Core Qt5Test)
6464
if [ -n "$QTCONFIG" ]; then
65-
QTBUILDCONFIG=$(pkg-config --variable=qt_config Qt5Core)
65+
QTBUILDCONFIG=$(pkg-config --variable=qt_config Qt5Core Qt5Test)
6666
[[ $QTBUILDCONFIG =~ (^|[[:space:]])reduce_relocations($|[[:space:]]) ]] && QTCONFIG="${QTCONFIG} -fPIC"
6767
set +e
6868
echo -e "#include <QString>" | ${CXX} ${CXX_OPT} ${QTCONFIG} -x c++ -

0 commit comments

Comments
 (0)