diff options
author | Topi Reinio <topi.reinio@qt.io> | 2019-08-13 13:26:48 +0200 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2019-08-21 15:04:42 +0200 |
commit | 6a5fb1ef73fc7a917efe3670fcdfa7aa6e09df86 (patch) | |
tree | 3ee19021c42f04b2c94acf86e3f5d217607b7f6a | |
parent | 771fdc5b13f1b13c82eeaf513696b2e564326b80 (diff) |
qdoc: Avoid errors related to PCH usage
Remove whitespace from the default parameters passed to Clang, and
add '-ferror-limit=0' to disable the error limit. This helps to
ensure we get a usable precompiled header on all platforms.
Another issue that manifested on Windows was the order in which
the (temporary) module header and the PCH was built - after writing
the module header, its QFile was closed at the end of the function
scope, and it received a timestamp later than the PCH. Some versions
of libclang see this (rightfully) as a problem.
Close the module header file handle before generating the PCH.
Task-number: QTBUG-75053
Change-Id: I61d066c40eddfdfdcc4c8cd847f6bec40652f9e0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r-- | src/qdoc/clangcodeparser.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qdoc/clangcodeparser.cpp b/src/qdoc/clangcodeparser.cpp index b7f9e86ad..b628c4cd1 100644 --- a/src/qdoc/clangcodeparser.cpp +++ b/src/qdoc/clangcodeparser.cpp @@ -1125,13 +1125,14 @@ static const char *defaultArgs_[] = { "-DQ_QDOC", "-DQ_CLANG_QDOC", "-DQT_DISABLE_DEPRECATED_BEFORE=0", - "-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__), #type);", - "-DQT_ANNOTATE_CLASS2(type,a1,a2)=static_assert(sizeof(#a1, #a2), #type);", + "-DQT_ANNOTATE_CLASS(type,...)=static_assert(sizeof(#__VA_ARGS__),#type);", + "-DQT_ANNOTATE_CLASS2(type,a1,a2)=static_assert(sizeof(#a1,#a2),#type);", "-DQT_ANNOTATE_FUNCTION(a)=__attribute__((annotate(#a)))", "-DQT_ANNOTATE_ACCESS_SPECIFIER(a)=__attribute__((annotate(#a)))", "-Wno-constant-logical-operand", "-Wno-macro-redefined", "-Wno-nullability-completeness", + "-ferror-limit=0", "-I" CLANG_RESOURCE_DIR }; @@ -1302,6 +1303,7 @@ void ClangCodeParser::buildPCH() out << line << "\n"; } } + tmpHeaderFile.close(); } if (printParsingErrors_ == 0) Location::logToStdErrAlways("clang not printing errors; include paths were guessed"); |