From e1f3732197ef77a29cb7f3c1ce094b3f31a7b689 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 24 Jul 2013 19:45:58 +0200 Subject: [PATCH] complain about absent files to -pro argument Task-number: QTBUG-30618 Change-Id: I908fc3792bdc321370e51be98adf7a9c81e37a85 Reviewed-by: Joerg Bornemann --- src/linguist/lupdate/main.cpp | 3 ++- src/linguist/shared/qmakeparser.cpp | 8 ++++---- src/linguist/shared/qmakeparser.h | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp index cc0d42a..7229c9c 100644 --- a/src/linguist/lupdate/main.cpp +++ b/src/linguist/lupdate/main.cpp @@ -436,7 +436,8 @@ static void processProjects(bool topLevel, bool nestComplain, const QStringList visitor.setCumulative(true); visitor.setOutputDir(option->shadowedPath(proFile)); ProFile *pro; - if (!(pro = parser->parsedProFile(proFile))) { + if (!(pro = parser->parsedProFile(proFile, topLevel ? QMakeParser::ParseReportMissing + : QMakeParser::ParseDefault))) { if (topLevel) *fail = true; continue; diff --git a/src/linguist/shared/qmakeparser.cpp b/src/linguist/shared/qmakeparser.cpp index 690a1c0..e73d814 100644 --- a/src/linguist/shared/qmakeparser.cpp +++ b/src/linguist/shared/qmakeparser.cpp @@ -182,7 +182,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags) locker.unlock(); #endif pro = new ProFile(fileName); - if (!read(pro)) { + if (!read(pro, flags)) { delete pro; pro = 0; } else { @@ -203,7 +203,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags) } } else { pro = new ProFile(fileName); - if (!read(pro)) { + if (!read(pro, flags)) { delete pro; pro = 0; } @@ -228,11 +228,11 @@ void QMakeParser::discardFileFromCache(const QString &fileName) m_cache->discardFile(fileName); } -bool QMakeParser::read(ProFile *pro) +bool QMakeParser::read(ProFile *pro, ParseFlags flags) { QFile file(pro->fileName()); if (!file.open(QIODevice::ReadOnly)) { - if (m_handler && IoUtils::exists(pro->fileName())) + if (m_handler && ((flags && ParseReportMissing) || IoUtils::exists(pro->fileName()))) m_handler->message(QMakeParserHandler::ParserIoError, fL1S("Cannot read %1: %2").arg(pro->fileName(), file.errorString())); return false; diff --git a/src/linguist/shared/qmakeparser.h b/src/linguist/shared/qmakeparser.h index 51e3033..e1dd090 100644 --- a/src/linguist/shared/qmakeparser.h +++ b/src/linguist/shared/qmakeparser.h @@ -88,7 +88,8 @@ public: enum ParseFlag { ParseDefault = 0, - ParseUseCache = 1 + ParseUseCache = 1, + ParseReportMissing = 2 }; Q_DECLARE_FLAGS(ParseFlags, ParseFlag) @@ -135,7 +136,7 @@ private: ushort terminator; // '}' if replace function call is braced, ':' if test function }; - bool read(ProFile *pro); + bool read(ProFile *pro, ParseFlags flags); bool read(ProFile *pro, const QString &content, int line, SubGrammar grammar); ALWAYS_INLINE void putTok(ushort *&tokPtr, ushort tok); -- 2.7.4