summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools/moc
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-05-31 04:05:43 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-06-05 22:23:01 +0000
commit9cb08c4c0de1685551c18e3b7958a00afa2a4c6a (patch)
tree12b615d06d56d2bc67dbaddf2336e734bd0b6021 /tests/auto/tools/moc
parente22f766bda7c405ab4daa27b553d4100dcfa811f (diff)
Moc: streamline how diagnostic messages are printed
If we don't have a valid Symbol to get a line number from, or if the symbol.lineNum is -1, print a shorter message containing only the file path. Printing: '/path/to/file:-1:1' isn't useful (and looks wrong). Change error/defaultErrorMsg/warning/note() to delegate to one central method, so that they all behave the same; e.g. previously warning() and note(), guarded against printing "-1" for the line number, whereas error() didn't. This also makes it possible to use error() for reporting other issues (e.g. the size of generator.strings list exceeding INT_MAX, which will happen in a later commit). Pick-to: 6.6 Change-Id: Iddc96e08315fae415be6a84928f845d7bceb4c5f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/tools/moc')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index b0cc42c6b6..26522e94ef 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -2184,7 +2184,7 @@ void tst_Moc::warnings_data()
<< QStringList()
<< 0
<< QString()
- << QString("standard input:0:1: note: No relevant classes found. No output generated.");
+ << QString("standard input: note: No relevant classes found. No output generated.");
// passing "-nn" should suppress "no relevant classes" note
QTest::newRow("-nn")
@@ -2326,7 +2326,7 @@ void tst_Moc::warnings_data()
<< QStringList()
<< 1
<< QString("IGNORE_ALL_STDOUT")
- << QString(":-1:1: error: Unexpected character in macro argument list.");
+ << QString(": error: Unexpected character in macro argument list.");
QTest::newRow("Missing header warning")
<< QByteArray("class X : public QObject { Q_OBJECT };")