Improve qt.cfg: unreadVariable for macro parameter (#4683)

This commit is contained in:
chrchr-github 2023-01-07 23:29:47 +01:00 committed by GitHub
parent 4ebdf5fae1
commit b29f111082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View File

@ -5179,15 +5179,15 @@
<define name="QT_TRANSLATE_NOOP3_UTF8(scope, x, comment)" value="{x, comment}"/>
<define name="QCOMPARE(actual, expected)" value="(void)((actual)==(expected))"/>
<define name="QVERIFY(condition)" value="(void)(condition)"/>
<define name="QVERIFY2(condition, message)" value="(void)(condition)"/>
<define name="QVERIFY2(condition, message)" value="(void)(condition),(void)(message)"/>
<define name="QBENCHMARK_ONCE" value=""/>
<define name="QBENCHMARK" value=""/>
<define name="QTRY_COMPARE(actual, expected)" value="(void)((actual)==(expected))"/>
<define name="QTRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)" value="(void)((actual)==(expected))"/>
<define name="QTRY_VERIFY2(condition, message)" value="(void)(condition)"/>
<define name="QTRY_VERIFY2(condition, message)" value="(void)(condition),(void)(message)"/>
<define name="QTRY_VERIFY(condition)" value="(void)(condition)"/>
<define name="QTRY_VERIFY2_WITH_TIMEOUT(condition, message, timeout)" value="(void)(condition)"/>
<define name="QTRY_VERIFY_WITH_TIMEOUT(condition, timeout)" value="(void)(condition)"/>
<define name="QTRY_VERIFY2_WITH_TIMEOUT(condition, message, timeout)" value="(void)(condition),(void)(message),(void)(timeout)"/>
<define name="QTRY_VERIFY_WITH_TIMEOUT(condition, timeout)" value="(void)(condition),(void)(timeout)"/>
<define name="QTEST_GUILESS_MAIN(testclass)" value=""/>
<define name="QTEST_APPLESS_MAIN(testclass)" value=""/>
<define name="QTEST_MAIN(testclass)" value=""/>
@ -5215,6 +5215,7 @@
<define name="QT_FORWARD_DECLARE_STRUCT(name)" value="struct name;"/>
<!-- https://doc.qt.io/qt-5/qstring.html#QStringLiteral -->
<define name="QStringLiteral(str)" value="QString::fromUtf8(str, sizeof(str) - 1)"/>
<define name="QByteArrayLiteral(str)" value="QByteArray(str)"/>
<!-- https://doc.qt.io/qt-5/qtglobal.html#qreal-typedef -->
<define name="qreal" value="double"/>
<podtype name="qint8" sign="s" size="1"/>

View File

@ -19,6 +19,7 @@
#include <cstdio>
#include <QCoreApplication>
#include <QLoggingCategory>
#include <QTest>
void QString1(QString s)
@ -412,6 +413,13 @@ void MacroTest2_test()
#endif
}
void MacroTest3()
{
QByteArray message = QByteArrayLiteral("Test1");
message += QByteArrayLiteral("Test2");
QVERIFY2(2 >= 0, message.constData());
}
void validCode(int * pIntPtr, QString & qstrArg)
{
if (QFile::exists("test")) {}

View File

@ -33,7 +33,7 @@ CC_OPT='-Wno-format -Wno-stringop-overread -Wno-nonnull -Wno-implicit-function-d
function get_pkg_config_cflags {
set +e
PKGCONFIG=$(pkg-config --cflags $1)
PKGCONFIG=$(pkg-config --cflags "$@")
PKGCONFIG_RETURNCODE=$?
set -e
if [ $PKGCONFIG_RETURNCODE -ne 0 ]; then
@ -60,9 +60,9 @@ function gnu_fn {
# qt.cpp
function qt_fn {
if [ $HAS_PKG_CONFIG -eq 1 ]; then
QTCONFIG=$(get_pkg_config_cflags Qt5Core)
QTCONFIG=$(get_pkg_config_cflags Qt5Core Qt5Test)
if [ -n "$QTCONFIG" ]; then
QTBUILDCONFIG=$(pkg-config --variable=qt_config Qt5Core)
QTBUILDCONFIG=$(pkg-config --variable=qt_config Qt5Core Qt5Test)
[[ $QTBUILDCONFIG =~ (^|[[:space:]])reduce_relocations($|[[:space:]]) ]] && QTCONFIG="${QTCONFIG} -fPIC"
set +e
echo -e "#include <QString>" | ${CXX} ${CXX_OPT} ${QTCONFIG} -x c++ -