diff --git a/sphinx/domains/c/__init__.py b/sphinx/domains/c/__init__.py index d02d35d97..e82912c16 100644 --- a/sphinx/domains/c/__init__.py +++ b/sphinx/domains/c/__init__.py @@ -259,8 +259,14 @@ class CObject(ObjectDescription[ASTDeclaration]): self.env.temp_data['c:last_symbol'] = e.symbol msg = __("Duplicate C declaration, also defined at %s:%s.\n" "Declaration is '.. c:%s:: %s'.") - msg = msg % (e.symbol.docname, e.symbol.line, self.display_object_type, sig) - logger.warning(msg, location=signode) + logger.warning( + msg, + e.symbol.docname, + e.symbol.line, + self.display_object_type, + sig, + location=signode, + ) if ast.objectType == 'enumerator': self._add_enumerator_to_parent(ast) diff --git a/sphinx/domains/c/_symbol.py b/sphinx/domains/c/_symbol.py index 01b159ac8..f7337a047 100644 --- a/sphinx/domains/c/_symbol.py +++ b/sphinx/domains/c/_symbol.py @@ -508,9 +508,14 @@ class Symbol: name = str(ourChild.declaration) msg = __("Duplicate C declaration, also defined at %s:%s.\n" "Declaration is '.. c:%s:: %s'.") - msg = msg % (ourChild.docname, ourChild.line, - ourChild.declaration.directiveType, name) - logger.warning(msg, location=(otherChild.docname, otherChild.line)) + logger.warning( + msg, + ourChild.docname, + ourChild.line, + ourChild.declaration.directiveType, + name, + location=(otherChild.docname, otherChild.line), + ) else: # Both have declarations, and in the same docname. # This can apparently happen, it should be safe to diff --git a/sphinx/domains/cpp/__init__.py b/sphinx/domains/cpp/__init__.py index 6a9756f5c..451836111 100644 --- a/sphinx/domains/cpp/__init__.py +++ b/sphinx/domains/cpp/__init__.py @@ -359,9 +359,14 @@ class CPPObject(ObjectDescription[ASTDeclaration]): self.env.temp_data['cpp:last_symbol'] = e.symbol msg = __("Duplicate C++ declaration, also defined at %s:%s.\n" "Declaration is '.. cpp:%s:: %s'.") - msg = msg % (e.symbol.docname, e.symbol.line, - self.display_object_type, sig) - logger.warning(msg, location=signode) + logger.warning( + msg, + e.symbol.docname, + e.symbol.line, + self.display_object_type, + sig, + location=signode, + ) if ast.objectType == 'enumerator': self._add_enumerator_to_parent(ast) diff --git a/sphinx/domains/cpp/_symbol.py b/sphinx/domains/cpp/_symbol.py index 0a2d5ade7..1cb716955 100644 --- a/sphinx/domains/cpp/_symbol.py +++ b/sphinx/domains/cpp/_symbol.py @@ -792,9 +792,14 @@ class Symbol: name = str(ourChild.declaration) msg = __("Duplicate C++ declaration, also defined at %s:%s.\n" "Declaration is '.. cpp:%s:: %s'.") - msg = msg % (ourChild.docname, ourChild.line, - ourChild.declaration.directiveType, name) - logger.warning(msg, location=(otherChild.docname, otherChild.line)) + logger.warning( + msg, + ourChild.docname, + ourChild.line, + ourChild.declaration.directiveType, + name, + location=(otherChild.docname, otherChild.line), + ) else: if (otherChild.declaration.objectType == ourChild.declaration.objectType and