Skip to content

Commit

Permalink
Rename to duplicate_declaration.{c,cpp}
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jan 3, 2025
1 parent 95a3084 commit 9c75b1e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ Deprecated
Features added
--------------

* C: Added ``c.duplicate_declaration`` to the warning control options.
Patch by Julien Lecomte.
* Add a new ``duplicate_declaration`` warning type,
with ``duplicate_declaration.c`` and ``duplicate_declaration.cpp`` subtypes.
Patch by Julien Lecomte and Adam Turner.

Bugs fixed
----------
Expand Down
3 changes: 2 additions & 1 deletion doc/usage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,8 @@ Options for warning control
* ``config.cache``
* ``docutils``
* ``download.not_readable``
* ``duplicate_declaration.c``
* ``duplicate_declaration.cpp``
* ``epub.unknown_project_files``
* ``epub.duplicated_toc_entry``
* ``i18n.inconsistent_references``
Expand Down Expand Up @@ -1404,7 +1406,6 @@ Options for warning control
* ``autosectionlabel.<document name>``
* ``autosummary``
* ``autosummary.import_cycle``
* ``c.duplicate_declaration``
* ``intersphinx.external``

You can choose from these types. You can also give only the first
Expand Down
4 changes: 2 additions & 2 deletions sphinx/domains/c/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ def handle_signature(self, sig: str, signode: TextElement) -> ASTDeclaration:
self.display_object_type,
sig,
location=signode,
type='c',
subtype='duplicate_declaration',
type='duplicate_declaration',
subtype='c',
)

if ast.objectType == 'enumerator':
Expand Down
4 changes: 2 additions & 2 deletions sphinx/domains/c/_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ def merge_with(
our_child.declaration.directiveType,
name,
location=(other_child.docname, other_child.line),
type='c',
subtype='duplicate_declaration',
type='duplicate_declaration',
subtype='c',
)
else:
# Both have declarations, and in the same docname.
Expand Down
2 changes: 2 additions & 0 deletions sphinx/domains/cpp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ def handle_signature(self, sig: str, signode: desc_signature) -> ASTDeclaration:
self.display_object_type,
sig,
location=signode,
type='duplicate_declaration',
subtype='cpp',
)

if ast.objectType == 'enumerator':
Expand Down
2 changes: 2 additions & 0 deletions sphinx/domains/cpp/_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,8 @@ def unconditional_add(self: Symbol, other_child: Symbol) -> None:
our_child.declaration.directiveType,
name,
location=(other_child.docname, other_child.line),
type='duplicate_declaration',
subtype='cpp',
)
else:
our_object_type = our_child.declaration.objectType
Expand Down

0 comments on commit 9c75b1e

Please sign in to comment.