Description: Tolerate members reported in several same-named compounds by Doxygen
 The dependency graph generation script for the Doxygen documentation aborted
 with an assertion error because newer Doxygen versions report the same member
 as part of more than one class or namespace compound that carries the same
 name.  Keep the first association and report a warning instead of aborting.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Origin: vendor
Forwarded: not-needed
Last-Update: 2026-09-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- gromacs-2025.4.orig/docs/doxygen/doxygenxml.py
+++ gromacs-2025.4/docs/doxygen/doxygenxml.py
@@ -411,19 +411,30 @@ class Member(Entity):
         """Add a compound that contains this member."""
         self._parents.add(compound)
         if isinstance(compound, Class):
-            assert (
-                self._class is None
-            ), 'Class "{0}" was already added. Maybe you have two entities with the same name {1}'.format(
-                self._class, self._name
-            )
-            self._class = compound
+            if self._class is None:
+                self._class = compound
+            else:
+                # Newer Doxygen versions can report the same member as part of
+                # more than one class compound that has the same name (for
+                # example for members documented with \related together with
+                # using declarations inside anonymous namespaces).  Keep the
+                # first association and report a warning instead of aborting.
+                self._get_reporter().xml_assert(
+                    None,
+                    'member "{0}" belongs to two classes ("{1}" and "{2}");'
+                    " keeping the first one".format(self._name, self._class, compound),
+                )
         elif isinstance(compound, Namespace):
-            assert (
-                self._namespace is None
-            ), 'Namespace "{0}" was already added. Maybe you have two entities with the same name {1}'.format(
-                self._namespace, self._name
-            )
-            self._namespace = compound
+            if self._namespace is None:
+                self._namespace = compound
+            else:
+                self._get_reporter().xml_assert(
+                    None,
+                    'member "{0}" belongs to two namespaces ("{1}" and "{2}");'
+                    " keeping the first one".format(
+                        self._name, self._namespace, compound
+                    ),
+                )
         elif isinstance(compound, File):
             self._files.add(compound)
         elif isinstance(compound, Group):
