Add new `duplicate_declaration.{c,cpp}` warning types (#13173)

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
Julien Lecomte 2025-01-03 03:48:07 +01:00 committed by GitHub
parent 504eecada8
commit fddbd7d151
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 17 additions and 0 deletions

View File

@ -18,6 +18,10 @@ Deprecated
Features added Features added
-------------- --------------
* 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 Bugs fixed
---------- ----------

View File

@ -1374,6 +1374,8 @@ Options for warning control
* ``config.cache`` * ``config.cache``
* ``docutils`` * ``docutils``
* ``download.not_readable`` * ``download.not_readable``
* ``duplicate_declaration.c``
* ``duplicate_declaration.cpp``
* ``epub.unknown_project_files`` * ``epub.unknown_project_files``
* ``epub.duplicated_toc_entry`` * ``epub.duplicated_toc_entry``
* ``i18n.inconsistent_references`` * ``i18n.inconsistent_references``
@ -1444,6 +1446,9 @@ Options for warning control
.. versionadded:: 8.0 .. versionadded:: 8.0
Added ``misc.copy_overwrite``. Added ``misc.copy_overwrite``.
.. versionadded:: 8.2
Added ``duplicate_declaration.c`` and ``duplicate_declaration.cpp``.
Builder options Builder options
=============== ===============

View File

@ -284,6 +284,8 @@ class CObject(ObjectDescription[ASTDeclaration]):
self.display_object_type, self.display_object_type,
sig, sig,
location=signode, location=signode,
type='duplicate_declaration',
subtype='c',
) )
if ast.objectType == 'enumerator': if ast.objectType == 'enumerator':

View File

@ -548,6 +548,8 @@ class Symbol:
our_child.declaration.directiveType, our_child.declaration.directiveType,
name, name,
location=(other_child.docname, other_child.line), location=(other_child.docname, other_child.line),
type='duplicate_declaration',
subtype='c',
) )
else: else:
# Both have declarations, and in the same docname. # Both have declarations, and in the same docname.

View File

@ -397,6 +397,8 @@ class CPPObject(ObjectDescription[ASTDeclaration]):
self.display_object_type, self.display_object_type,
sig, sig,
location=signode, location=signode,
type='duplicate_declaration',
subtype='cpp',
) )
if ast.objectType == 'enumerator': if ast.objectType == 'enumerator':

View File

@ -895,6 +895,8 @@ class Symbol:
our_child.declaration.directiveType, our_child.declaration.directiveType,
name, name,
location=(other_child.docname, other_child.line), location=(other_child.docname, other_child.line),
type='duplicate_declaration',
subtype='cpp',
) )
else: else:
our_object_type = our_child.declaration.objectType our_object_type = our_child.declaration.objectType