On 06/02/2024 05:42, Mauro Carvalho Chehab wrote:
Em Mon, 5 Feb 2024 18:51:29 +0100
Vegard Nossum <vegard.nossum@xxxxxxxxxx> escreveu:
@@ -67,12 +70,6 @@ class KernelFeat(Directive):
"debug" : directives.flag
}
- def warn(self, message, **replace):
- replace["fname"] = self.state.document.current_source
- replace["line_no"] = replace.get("line_no", self.lineno)
- message = ("%(fname)s:%(line_no)s: [kernel-feat WARN] : " + message) % replace
- self.state.document.settings.env.app.warn(message, prefix="")
-
That doesn't sound right.
If you remove the logic which gets the actual file name and line where
the error/warning have occurred, how are you handing now the special
output with such data produced by get_abi.pl to return the real file
name/line number where the error occurred?
Had you test changing an ABI file to cause a Sphinx warning and
ensured that the produced warning will report the actual location
of the warning, instead of shooting the messenger?
Sorry, I should have described this change better.
I don't think this warn() method is called at all from anywhere --
removing it here was meant as pure cleanup.
Maybe I don't understand the mechanism, though. Is this called
indirectly somewhere through Sphinx? I see there's a warning() method in
the Directive class, but this is self.warn() we're talking about.
(BTW, this is in kernel_feat.py -- not kernel_abi.py.)
If I add some bad syntax (like :doc:`) to one of the
Documentation/features/ descriptions, I get a warning like this:
/home/vegard/linux/Documentation/arch/m68k/features.rst:23: WARNING:
Inline interpreted text or phrase reference start-string without end-string.
I've verified that this does not change with this patch; kernel_feat.py
has always reported source warnings in this way; self.warn() has been
unused since the extension was added, as far as I can tell.
(kernel_abi.py is a different story, it attempts to report the correct
source lines, but I'm not convinced that it works properly either.
Tackling both scripts to generate correct warnings is next on my TODO,
but out of scope for this series.)
Vegard