From 8be8426091604aec0dc978700634fb0311099259 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 4 Nov 2022 18:06:33 +0100 Subject: qdoc: Attempt to read macro arguments only once QDoc supports multiple versions of macros, one for each supported output format: macro.hello.HTML = "

Hi, \1

" macro.hello.DocBook = "Hi, \1" Macros can also take arguments. However, with multiple format-specific versions defined, QDoc attempted to also read the arguments multiple times. This fails on the second attempt as the internal position has been already advanced beyond the arguments. Implement a new helper function, DocParser::getMacroArguments(), and use it to read the arguments only once. Fixes: QTBUG-108219 Pick-to: 6.2 6.4 Change-Id: Icad7e51b93c00a2632746ea2fe05d36459b9acda Reviewed-by: Paul Wicking --- .../docbook-nestedmacro/testcpp-module.xml | 85 ++++++++++++++++++++++ .../nestedmacro/testcpp-module.html | 1 + .../testdata/configs/nestedmacro.qdocconf | 12 ++- .../generatedoutput/testdata/testcpp/testcpp.cpp | 3 +- .../qdoc/generatedoutput/tst_generatedoutput.cpp | 3 +- 5 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 tests/auto/qdoc/generatedoutput/expected_output/docbook-nestedmacro/testcpp-module.xml (limited to 'tests') diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook-nestedmacro/testcpp-module.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook-nestedmacro/testcpp-module.xml new file mode 100644 index 000000000..f9d172f3f --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook-nestedmacro/testcpp-module.xml @@ -0,0 +1,85 @@ + + + +QDoc Test C++ Classes +TestCPP +TestCPP Reference Documentation + +A test module page. +This module was introduced in Qt 2.0. + + +A test module page. +This module was introduced in Qt 2.0. + +Namespaces + + +CrossModuleRef + +Namespace that has documented functions in multiple modules. + + + +TestQDoc + +A namespace. + + + + + +Classes + + +TestQDoc::Test + +A class in a namespace. + + + +TestQDoc::TestDerived + +A derived class in a namespace. + + + + + +Detailed Description + +This is just a test. /* Look, Ma! {I'm made of arguments!} */ + +This module was introduced in version 5.15. +1.0 + +Linking to function-like things + + +someFunctionDefaultArg() + + +QDOCTEST_MACRO2() + + +QDOCTEST_MACRO2(int &x) + + +section() + + +section() is a section title + + +open( parenthesis + + +C++11 added std::move(T&& t) + + + +section() + + + + diff --git a/tests/auto/qdoc/generatedoutput/expected_output/nestedmacro/testcpp-module.html b/tests/auto/qdoc/generatedoutput/expected_output/nestedmacro/testcpp-module.html index 8f728c7be..d08023a3d 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/nestedmacro/testcpp-module.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/nestedmacro/testcpp-module.html @@ -40,6 +40,7 @@

Note: This is just a test. /* Look, Ma! {I'm made of arguments!} */

This module was introduced in version 5.15.

+

1.0

Linking to function-like things