From 263b86a5591082fb173c400a05ac81372072934b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 1 May 2013 11:16:28 +0200 Subject: [PATCH] moc: use fprintf instead of qWarning qWarning now depends on QT_MESSAGE_PATTERN, depending on that variable. It will show things like the moc process id or the Parser::error function name. We don't want that. Change-Id: I5b35401200f0f7de2442aa77d700a82402081489 Reviewed-by: Simon Hausmann --- src/tools/moc/parser.cpp | 4 ++-- tests/auto/tools/moc/tst_moc.cpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tools/moc/parser.cpp b/src/tools/moc/parser.cpp index c0591b69c0..4c754786f7 100644 --- a/src/tools/moc/parser.cpp +++ b/src/tools/moc/parser.cpp @@ -64,10 +64,10 @@ void Parser::error(int rollback) { } void Parser::error(const char *msg) { if (msg || error_msg) - qWarning(ErrorFormatString "Error: %s", + fprintf(stderr, ErrorFormatString "Error: %s\n", currentFilenames.top().constData(), symbol().lineNum, msg?msg:error_msg); else - qWarning(ErrorFormatString "Parse error at \"%s\"", + fprintf(stderr, ErrorFormatString "Parse error at \"%s\"\n", currentFilenames.top().constData(), symbol().lineNum, symbol().lexem().data()); exit(EXIT_FAILURE); } diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 3cd2f1f936..e0179b393b 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1734,6 +1734,11 @@ void tst_Moc::warnings() #endif QProcess proc; + + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + env.insert("QT_MESSAGE_PATTERN", "no qDebug or qWarning please"); + proc.setProcessEnvironment(env); + proc.start("moc", args); QVERIFY(proc.waitForStarted());