From 38f38806c9d19eefc293f6fd1b978020818f383b Mon Sep 17 00:00:00 2001 From: Yuri Edward Date: Tue, 12 May 2020 21:53:02 +0200 Subject: [PATCH] documentation/doxygen: fixed bug with exception references. --- documentation/doxygen.py | 6 +- .../compound_exception_reference/Doxyfile | 14 +++ .../compound_exception_reference/File.h | 13 +++ .../compound_exception_reference/File_8h.html | 85 +++++++++++++++++++ documentation/test_doxygen/test_compound.py | 8 ++ 5 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 documentation/test_doxygen/compound_exception_reference/Doxyfile create mode 100644 documentation/test_doxygen/compound_exception_reference/File.h create mode 100644 documentation/test_doxygen/compound_exception_reference/File_8h.html diff --git a/documentation/doxygen.py b/documentation/doxygen.py index 92a4886f..11f98889 100755 --- a/documentation/doxygen.py +++ b/documentation/doxygen.py @@ -977,7 +977,11 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET. elif i.attrib['kind'] == 'retval': out.return_values += [(name.text, description)] elif i.attrib['kind'] == 'exception': - out.exceptions += [(name.text, description)] + ref = name.find('ref') + if (ref != None): + out.exceptions += [(parse_ref(state, ref), description)] + else: + out.exceptions += [(name.text, description)] else: assert i.attrib['kind'] == 'templateparam' out.templates[name.text] = description diff --git a/documentation/test_doxygen/compound_exception_reference/Doxyfile b/documentation/test_doxygen/compound_exception_reference/Doxyfile new file mode 100644 index 00000000..7e9ad922 --- /dev/null +++ b/documentation/test_doxygen/compound_exception_reference/Doxyfile @@ -0,0 +1,14 @@ +INPUT = File.h +QUIET = YES +GENERATE_HTML = NO +GENERATE_LATEX = NO +GENERATE_XML = YES +XML_PROGRAMLISTING = NO +CASE_SENSE_NAMES = YES + +##! M_PAGE_FINE_PRINT = +##! M_THEME_COLOR = +##! M_FAVICON = +##! M_LINKS_NAVBAR1 = +##! M_LINKS_NAVBAR2 = +##! M_SEARCH_DISABLED = YES diff --git a/documentation/test_doxygen/compound_exception_reference/File.h b/documentation/test_doxygen/compound_exception_reference/File.h new file mode 100644 index 00000000..62e434de --- /dev/null +++ b/documentation/test_doxygen/compound_exception_reference/File.h @@ -0,0 +1,13 @@ +/** @file + * @brief A file + */ + +/** @brief An exception */ +struct MyException {}; + +/** +@brief A function that throws +@throw std::runtime_exception This one doesn't have a reference +@throw MyException This one does +*/ +void foo(); diff --git a/documentation/test_doxygen/compound_exception_reference/File_8h.html b/documentation/test_doxygen/compound_exception_reference/File_8h.html new file mode 100644 index 00000000..fd72df8b --- /dev/null +++ b/documentation/test_doxygen/compound_exception_reference/File_8h.html @@ -0,0 +1,85 @@ + + + + + File.h file | My Project + + + + + +
+
+
+
+
+

+ File.h file +

+

A file.

+
+

Contents

+ +
+
+

Classes

+
+
+ struct MyException +
+
An exception.
+
+
+
+

Functions

+
+
+ void foo() +
+
A function that throws.
+
+
+
+

Function documentation

+
+

+ void foo() +

+

A function that throws.

+ + + + + + + + + + + + + + +
Exceptions
std::runtime_exceptionThis one doesn't have a reference
MyExceptionThis one does
+
+
+
+
+
+
+ + diff --git a/documentation/test_doxygen/test_compound.py b/documentation/test_doxygen/test_compound.py index 9450fa38..a04b9faf 100644 --- a/documentation/test_doxygen/test_compound.py +++ b/documentation/test_doxygen/test_compound.py @@ -357,3 +357,11 @@ class Since(IntegrationTestCase): self.assertEqual(*self.actual_expected_contents('modules.html')) self.assertEqual(*self.actual_expected_contents('namespaces.html')) self.assertEqual(*self.actual_expected_contents('pages.html')) + +class ExceptionReference(IntegrationTestCase): + def __init__(self, *args, **kwargs): + super().__init__(__file__, 'exception_reference', *args, **kwargs) + + def test(self): + self.run_doxygen(wildcard='*.xml') + self.assertEqual(*self.actual_expected_contents('File_8h.html')) -- 2.30.2