sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.23k stars 2.04k forks source link

Enum type interpreted as function name #10052

Open marxin opened 2 years ago

marxin commented 2 years ago

Describe the bug

In the following example:

.. function:: enum gimple_code gimple_code (gimple g)

  Return the code for statement ``G``.

There's a wrongly created a hyperlink to the function (after enum keyword):

Screenshot from 2022-01-03 13-30-09

How to Reproduce

Build the snippet.

Expected behavior

No response

Your project

Build the snippet

Screenshots

No response

OS

Linux

Python version

3.8

Sphinx version

4.3.1

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

jakobandersen commented 2 years ago

I think this is a duplicate of https://github.com/sphinx-doc/sphinx/issues/7740. The current xref lookup in both the C++ and C domains currently only use the parent symbol as reference, not the relative position inside each declaration. Additionally, neither domain yet makes a difference between tagged names and ordinary identifiers. For the C domain there is https://github.com/sphinx-doc/sphinx/pull/8313 which was stalled due to breakage of intersphinx lookups.