summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2022-06-13 17:10:44 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2022-06-17 00:05:53 +0200
commitcfcbf38f76e0073aa939be0d85b9787805c9332b (patch)
treea605afc9901bdf4bdd58b86af9d98d2d6d96b1b3 /tests
parent077eddb3e1aaba1517d67e7c83574c16e971dc67 (diff)
Teach qmake about digit-grouping apostrophes in numeric literals
It was previously understanding them as character literal delimiters, with unfortunate consequences if a numeric literal contained an odd number of them. Recognize that an apostrophe with a digit on each side of it isn't the opening quote of a character literal (unless the digit before it is preceded by a u). Extend the findMocs test to trigger the bug, prior to the fix; verified it passes with the fix. Fixes: QTBUG-98845 Change-Id: I5db3ac59aaeade7c2d6c1fb680ba97261ec0e8a9 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/digitseparated.h8
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/findMocs.pro3
-rw-r--r--tests/auto/tools/qmake/testdata/findMocs/main.cpp8
3 files changed, 16 insertions, 3 deletions
diff --git a/tests/auto/tools/qmake/testdata/findMocs/digitseparated.h b/tests/auto/tools/qmake/testdata/findMocs/digitseparated.h
new file mode 100644
index 0000000000..ddedac26e3
--- /dev/null
+++ b/tests/auto/tools/qmake/testdata/findMocs/digitseparated.h
@@ -0,0 +1,8 @@
+#include <QObject>
+
+class AfterDigitSeparator : public QObject
+{
+ Q_OBJECT
+public:
+ AfterDigitSeparator() : QObject(nullptr) {}
+};
diff --git a/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro b/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
index af672c2621..de2fdff3d2 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
+++ b/tests/auto/tools/qmake/testdata/findMocs/findMocs.pro
@@ -1,5 +1,6 @@
DESTDIR = ./
HEADERS += object1.h object2.h object3.h object4.h \
- object5.h object6.h object7.h object8.h object9.h
+ object5.h object6.h object7.h object8.h object9.h \
+ digitseparated.h
SOURCES += main.cpp
diff --git a/tests/auto/tools/qmake/testdata/findMocs/main.cpp b/tests/auto/tools/qmake/testdata/findMocs/main.cpp
index 2123fca958..441df50d9e 100644
--- a/tests/auto/tools/qmake/testdata/findMocs/main.cpp
+++ b/tests/auto/tools/qmake/testdata/findMocs/main.cpp
@@ -1,7 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
#include <moc_object1.cpp>
#include <moc_object2.cpp>
#include <moc_object3.cpp>
@@ -12,4 +11,9 @@
#include "object8.h"
#include <moc_object9.cpp>
-int main() { return 0; }
+int main() { return 0'000; }
+/* Included *after* the use of a numeric literal with an *odd* number of digit
+ separator tick marks in it (and no subsequent apostrophe to end the
+ "single-quoted character literal" that the old parser though it was thus left
+ in). */
+#include <moc_digitseparated.cpp>