diff options
author | Topi Reinio <topi.reinio@qt.io> | 2021-10-12 15:30:52 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-10-12 22:35:28 +0000 |
commit | bc7639620a13a60c249afce60c2b238da16d6e15 (patch) | |
tree | e745a530e7a6adf1d1e5cf385d7044e54120aa62 | |
parent | 9acf2c2175de01a498395a547809c272d4351e4f (diff) | |
download | qttools-bc7639620a13a60c249afce60c2b238da16d6e15.tar.gz |
qdoc: Don't warn about undocumented namespaces if -no-link-errors is set
The documentation for the namespace can be (and often is) located in
another module. As -no-link-errors is set when testing documentation
builds of individual module without loading the .index files of any
dependencies, skip these warnings.
Document the warning.
Fixes: QTBUG-97453
Change-Id: Ie899f29fde20082a5880a6c9d475db1a88b70085
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit f701a03e1f2362b020b7a962187a0fe73632f17f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/qdoc/doc/qdoc-manual-qdocconf.qdoc | 5 | ||||
-rw-r--r-- | src/qdoc/doc/qdoc-warnings.qdoc | 12 | ||||
-rw-r--r-- | src/qdoc/qdocdatabase.cpp | 14 |
3 files changed, 24 insertions, 7 deletions
diff --git a/src/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/qdoc/doc/qdoc-manual-qdocconf.qdoc index c47d49784..3cdec870e 100644 --- a/src/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -344,7 +344,7 @@ of dependencies for a single module consists of actual build dependencies. In addition, if there is a documentation project (module) that acts as a top-level entry point for the entire - documentation set and provides \l {navigation-variable}[navigation} + documentation set and provides \l {navigation-variable}{navigation} links, each module documentation should include it as a dependency. When QDoc generates documentation for a project, it will also generate @@ -1902,8 +1902,7 @@ \target indexes-variable \section1 indexes - The \l {indexes-variable}[indexes} variable defines a set of paths - to index files to load. + The \c indexes variable defines a set of paths to index files to load. \badcode indexes = \ diff --git a/src/qdoc/doc/qdoc-warnings.qdoc b/src/qdoc/doc/qdoc-warnings.qdoc index cfaf86059..d40ad6abd 100644 --- a/src/qdoc/doc/qdoc-warnings.qdoc +++ b/src/qdoc/doc/qdoc-warnings.qdoc @@ -152,6 +152,18 @@ containing \l {namespace-command}{\\namespace} commands with the same argument, <name>. + \section1 <name> is documented, but namespace <namespace> is not documented in any module + + The documentation for \e {<name>} was found, but \e{<name>} is declared + under a namespace that is either undocumented or QDoc was unable to + locate the documentation for it. + + This can be resolved by either documenting \e{<namespace>}, or if it is + already documented in another module, ensure that this module has + a dependency to it. + + See also \l {depends-variable}{depends} and {indexes-variable}{indexes}. + \section1 Clang couldn't find function when parsing \\fn <signature> When parsing a \l {fn-command}{\\fn} statement, Clang compares this with the diff --git a/src/qdoc/qdocdatabase.cpp b/src/qdoc/qdocdatabase.cpp index 305003f82..3d3bc20ba 100644 --- a/src/qdoc/qdocdatabase.cpp +++ b/src/qdoc/qdocdatabase.cpp @@ -1090,6 +1090,8 @@ void QDocDatabase::resolveNamespaces() { if (!m_namespaceIndex.isEmpty()) return; + + bool linkErrors = !Config::instance().getBool(CONFIG_NOLINKERRORS); NodeMultiMap namespaceMultimap; Tree *t = m_forest.firstTree(); while (t) { @@ -1122,10 +1124,14 @@ void QDocDatabase::resolveNamespaces() } } } else if (!indexNamespace) { - // warn about documented children in undocumented namespaces - for (auto *node : namespaces) { - if (!node->isIndexNode()) - static_cast<NamespaceNode *>(node)->reportDocumentedChildrenInUndocumentedNamespace(); + // Warn about documented children in undocumented namespaces. + // As the namespace can be documented outside this project, + // skip the warning if -no-link-errors is set + if (linkErrors) { + for (auto *node : namespaces) { + if (!node->isIndexNode()) + static_cast<NamespaceNode *>(node)->reportDocumentedChildrenInUndocumentedNamespace(); + } } } else { for (auto *node : namespaces) { |