From 4a38f3be9c06c42690cf39e3f89c44f1c279fed3 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 26 Nov 2021 14:58:04 +0100 Subject: qdoc: Don't warn about \instantiates classes if -no-link-errors is set The C++ class that a QML type \instantiates can be 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. Clarify the potential causes of the warning in the documentation. Fixes: QTBUG-98517 Change-Id: I3014541544269f81587fbfd2b13b6dcacf96731c Reviewed-by: Paul Wicking --- src/qdoc/cppcodeparser.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/qdoc/cppcodeparser.cpp') diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index bf155c520..5314f3052 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -144,6 +144,8 @@ void CppCodeParser::initializeParser() m_exampleImageFilter = exampleImagePatterns.join(' '); else m_exampleImageFilter = "*.png"; + + m_showLinkErrors = !config.getBool(CONFIG_NOLINKERRORS); } /*! @@ -595,11 +597,16 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command, ClassNode *classNode = m_qdb->findClassNode(arg.split("::")); if (classNode) node->setClassNode(classNode); - else + else if (m_showLinkErrors) { doc.location().warning( - QStringLiteral("C++ class %1 not found: \\instantiates %1").arg(arg)); - } else - doc.location().warning(QStringLiteral("\\instantiates is only allowed in \\qmltype")); + QStringLiteral("C++ class %2 not found: \\%1 %2") + .arg(command, arg)); + } + } else { + doc.location().warning( + QStringLiteral("\\%1 is only allowed in \\%2") + .arg(command, COMMAND_QMLTYPE)); + } } else if (command == COMMAND_DEFAULT) { if (!node->isQmlProperty()) { doc.location().warning(QStringLiteral("Ignored '\\%1', applies only to '\\%2'") -- cgit v1.2.1