Skip to content

Commit

Permalink
Fix anonymous struct/union usage in C domain
Browse files Browse the repository at this point in the history
Sphinx's C domain parser expects '.' to be used to separate nested
names. This is currently broken when there are anonymous structs/unions
in the source, where the Doxygen XML provides some nested name with
"::@" in it, which  fails to be parsed properly. This commit adds a
check and does the proper substitution before sending data back to the
domain parser.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
  • Loading branch information
utzig committed Sep 24, 2020
1 parent 82759b1 commit 25056e2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1707,9 +1707,12 @@ def visit_variable(self, node) -> List[Node]:
if len(initializer) != 0:
options['value'] = initializer
else:
typename = ''.join(n.astext() for n in self.render(node.get_type()))
if dom == 'c' and '::' in typename:
typename = typename.replace('::', '.')
declaration = ' '.join([
self.create_template_prefix(node),
''.join(n.astext() for n in self.render(node.get_type())), # type: ignore
typename,
name,
node.get_argsstring(),
self.make_initializer(node)
Expand Down

0 comments on commit 25056e2

Please sign in to comment.