summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@qt.io>2019-04-05 11:45:26 +0200
committerMartin Smith <martin.smith@qt.io>2019-04-08 11:31:21 +0000
commit713af3ea43c838a3015d00b924cad69191333977 (patch)
tree9a92466e9b4b264b2fd33a8b31b92492687256f2
parent745bd6375a2e3351fb88e4afaad8cbb490859458 (diff)
downloadqttools-713af3ea43c838a3015d00b924cad69191333977.tar.gz
qdoc: Turn off clang errors in PCH build without include paths
When the build system can't pass qdoc the include paths to qdoc, qdoc tries to guess reasonable include paths. There has been one case running qdoc on macOS for the QtPlatformHeaders module, where qdoc must try to guess the include paths. The guessed paths are not sufficient, and clang prints a large number of errors caused by missing stuff. This change tells clang not to report errors during the PCH build if qdoc had to guess the include paths. qdoc reports in its log that it guessed the include paths and that it turned off the clang error reporting. Change-Id: I91a4242dcc7d3017d511d969621cc3d673c47963 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r--src/qdoc/clangcodeparser.cpp21
-rw-r--r--src/qdoc/clangcodeparser.h2
2 files changed, 19 insertions, 4 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp
index b8774b4a7..5bda5296b 100644
--- a/src/qdoc/clangcodeparser.cpp
+++ b/src/qdoc/clangcodeparser.cpp
@@ -1148,10 +1148,22 @@ static QVector<QByteArray> includePathsFromHeaders(const QHash<QString, QString>
}
/*!
- Load the include paths into \a moreArgs.
+ Load the include paths into \a moreArgs and return false.
+ If no include paths were provided, try to guess reasonable
+ include paths but return true, so the clang diagnostics
+ can be turned off during PCH creation.
+
+ The use case for returning true is the QtPlatformHeaders
+ module when running qdoc on macOS. For some reason, the
+ include paths are not passed to qdoc, so it guesses them.
+ This results in clang reporting a large number of errors
+ during the PCH build. The errors are useles, except that
+ it probably means the build system isn't working correctly
+ for QtPlatformHeaders when running qdoc.
*/
-void ClangCodeParser::getMoreArgs()
+bool ClangCodeParser::getMoreArgs()
{
+ bool guessedIncludePaths = false;
if (includePaths_.isEmpty()) {
Location::logToStdErrAlways("No include paths passed to qdoc");
Location::logToStdErrAlways("Guess reasonable include paths:");
@@ -1160,6 +1172,7 @@ void ClangCodeParser::getMoreArgs()
of reasonable places to look for include files and use
that list instead.
*/
+ guessedIncludePaths = true;
auto forest = qdb_->searchOrder();
QByteArray version = qdb_->version().toUtf8();
@@ -1190,6 +1203,7 @@ void ClangCodeParser::getMoreArgs()
moreArgs_[i] = fi.canonicalFilePath().toLatin1();
}
}
+ return guessedIncludePaths;
}
/*!
@@ -1306,7 +1320,8 @@ void ClangCodeParser::buildPCH()
void ClangCodeParser::precompileHeaders()
{
getDefaultArgs();
- getMoreArgs();
+ if (getMoreArgs())
+ printParsingErrors_ = 0;
for (const auto &p : qAsConst(moreArgs_))
args_.push_back(p.constData());
diff --git a/src/qdoc/clangcodeparser.h b/src/qdoc/clangcodeparser.h
index a8f00d1cc..a022ca9d3 100644
--- a/src/qdoc/clangcodeparser.h
+++ b/src/qdoc/clangcodeparser.h
@@ -65,7 +65,7 @@ public:
private:
void getDefaultArgs();
- void getMoreArgs();
+ bool getMoreArgs();
void buildPCH();
private: