sphinx-doc / sphinx-doc/sphinx

C, distinguish between ordinary identifiers and tag names

Open
#7,819 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domains:c type:bug
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
It should be possible to have a type with the same name as a struct/union/enum, as in the language.

To Reproduce
Steps to reproduce the behavior: as example, consider the following documentation (where every instance of struct could be replaced with union or enum instead):

.. c:struct:: foo
.. c:type:: struct foo foo

   No duplicate declaration warning.

- :c:struct::`foo`, link to the struct.
- :c:type::``foo``, link to the typedef.
- :c:any:``foo``, probably link to the type?
- Perhaps new feature: :c:any:``struct foo``, link to the struct.
- :c:expr:``foo*``, hyperlink ``foo`` to the typedef.
- c:expr:``struct foo*``, hyperlink ``foo`` (or all of ``struct foo``?) to the struct.

Expected behavior
See above.

Additional context

  • See also michaeljones/breathe#543.
  • An implementation of this could perhaps be split into something backwards compatible, and then the breaking part for the next major version.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the C-domain reproduction in the issue, covering c:struct, c:type, c:any, and c:expr references, and review the related Breathe issue. Define how ordinary identifiers and struct, union, and enum tag names should resolve, including the proposed c:any behavior and backwards-compatibility boundary. Done means the documented cases resolve without duplicate declaration warnings and the chosen compatibility behavior is specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
documentation
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.