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 <simon.hausmann@digia.com>
bb10
Olivier Goffart 2013-05-01 11:16:28 +02:00 committed by The Qt Project
parent 758f064558
commit 263b86a559
2 changed files with 7 additions and 2 deletions

View File

@ -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);
}

View File

@ -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());