complain about absent files to -pro argument
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>
Wed, 24 Jul 2013 17:45:58 +0000 (19:45 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 29 Jul 2013 15:46:32 +0000 (17:46 +0200)
Task-number: QTBUG-30618
Change-Id: I908fc3792bdc321370e51be98adf7a9c81e37a85
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
src/linguist/lupdate/main.cpp
src/linguist/shared/qmakeparser.cpp
src/linguist/shared/qmakeparser.h

index cc0d42a..7229c9c 100644 (file)
@@ -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;
index 690a1c0..e73d814 100644 (file)
@@ -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;
index 51e3033..e1dd090 100644 (file)
@@ -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);