From 7a707eb2ce7362aacca5cc986e728db146fe0e0e 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 (in lupdate) sync up; this doesn't actually do anything in creator (or qmake). Change-Id: I908fc3792bdc321370e51be98adf7a9c81e37a85 Reviewed-by: Joerg Bornemann (cherry picked from qtbase/15981b985fa3ae250af22f68ddb50e08bd9ce421) --- src/shared/proparser/qmakeparser.cpp | 8 ++++---- src/shared/proparser/qmakeparser.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/shared/proparser/qmakeparser.cpp b/src/shared/proparser/qmakeparser.cpp index 9f2d42d107e..7f447541d4f 100644 --- a/src/shared/proparser/qmakeparser.cpp +++ b/src/shared/proparser/qmakeparser.cpp @@ -172,7 +172,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 { @@ -193,7 +193,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; } @@ -218,12 +218,12 @@ void QMakeParser::discardFileFromCache(const QString &fileName) m_cache->discardFile(fileName); } -bool QMakeParser::read(ProFile *pro) +bool QMakeParser::read(ProFile *pro, ParseFlags flags) { QString content; QString errStr; if (!m_vfs->readFile(pro->fileName(), &content, &errStr)) { - if (m_handler && m_vfs->exists(pro->fileName())) + if (m_handler && ((flags & ParseReportMissing) || m_vfs->exists(pro->fileName()))) m_handler->message(QMakeParserHandler::ParserIoError, fL1S("Cannot read %1: %2").arg(pro->fileName(), errStr)); return false; diff --git a/src/shared/proparser/qmakeparser.h b/src/shared/proparser/qmakeparser.h index 06fa2c70fbe..1475a79e8cd 100644 --- a/src/shared/proparser/qmakeparser.h +++ b/src/shared/proparser/qmakeparser.h @@ -77,7 +77,8 @@ public: enum ParseFlag { ParseDefault = 0, - ParseUseCache = 1 + ParseUseCache = 1, + ParseReportMissing = 2 }; Q_DECLARE_FLAGS(ParseFlags, ParseFlag) @@ -124,7 +125,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);