chiark / gitweb /
documentation/doxygen: fix a friend class being parsed as a function.
authorCris Luengo <cris.l.luengo@gmail.com>
Wed, 6 Jan 2021 17:22:12 +0000 (10:22 -0700)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 10 Jan 2022 09:14:26 +0000 (10:14 +0100)
Doxygen 1.9 no longer contains a "friend" prefix in the <type>, causing
some conditions to trip up and some asserts to trip up even worse after
that.

Co-authored-by: Vladimír Vondruš <mosra@centrum.cz>
documentation/doxygen.py

index fb1d2c3a3e311d50768f63c2d49174b2b2ff8dc3..824e6413141ea114d44323747d4e7b2fcaf8ad2e 100755 (executable)
@@ -3011,8 +3011,9 @@ def parse_xml(state: State, xml: str):
                 for memberdef in compounddef_child:
                     # Ignore friend classes. This does not ignore friend
                     # classes written as `friend Foo;`, those are parsed as
-                    # variables (ugh).
-                    if memberdef.find('type').text in ['friend class', 'friend struct', 'friend union']:
+                    # variables (ugh). Since Doxygen 1.9 the `friend ` prefix
+                    # is omitted.
+                    if memberdef.find('type').text in ['class', 'struct', 'union', 'friend class', 'friend struct', 'friend union']:
                         # Print a warning in case these are documented
                         if (''.join(memberdef.find('briefdescription').itertext()).strip() or ''.join(memberdef.find('detaileddescription').itertext()).strip()):
                             logging.warning("{}: doxygen is unable to cross-link {}, ignoring, sorry".format(state.current, memberdef.find('definition').text))
@@ -3062,8 +3063,9 @@ def parse_xml(state: State, xml: str):
                     elif memberdef.attrib['kind'] == 'friend':
                         # Ignore friend classes. This does not ignore friend
                         # classes written as `friend Foo;`, those are parsed as
-                        # variables (ugh).
-                        if memberdef.find('type').text in ['friend class', 'friend struct', 'friend union'] and (memberdef.find('briefdescription').text or memberdef.find('detaileddescription').text):
+                        # variables (ugh). Since Doxygen 1.9 the `friend `
+                        # prefix is omitted.
+                        if memberdef.find('type').text in ['class', 'struct', 'union', 'friend class', 'friend struct', 'friend union'] and (memberdef.find('briefdescription').text or memberdef.find('detaileddescription').text):
                             logging.warning("{}: doxygen is unable to cross-link {}, ignoring, sorry".format(state.current, memberdef.find('definition').text))
                         # Only friend functions left, hopefully, parse as a func
                         else: