summaryrefslogtreecommitdiff
path: root/scripts/lib/kdoc/kdoc_files.py
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2025-04-08 13:09:31 +0300
committerJonathan Corbet <corbet@lwn.net>2025-04-09 21:10:34 +0300
commit11afeab6d74d1be80420b47113c4893c88dcc04b (patch)
tree60191a596a164a53274637ccba436f65eade50d2 /scripts/lib/kdoc/kdoc_files.py
parente4b2bd908c3d8f071d4fac6e588fffc6110c1b1f (diff)
downloadlinux-11afeab6d74d1be80420b47113c4893c88dcc04b.tar.xz
scripts/kernel-doc.py: Properly handle Werror and exit codes
The original kernel-doc script has a logic to return warnings as errors, and to report the number of warnings found, if in verbose mode. Implement it to be fully compatible with the original script. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/de33b0cebd9fdf82d8b221bcfe41db7269286222.1744106242.git.mchehab+huawei@kernel.org
Diffstat (limited to 'scripts/lib/kdoc/kdoc_files.py')
-rw-r--r--scripts/lib/kdoc/kdoc_files.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/lib/kdoc/kdoc_files.py b/scripts/lib/kdoc/kdoc_files.py
index e52a6d05237e..182d9ed58a72 100644
--- a/scripts/lib/kdoc/kdoc_files.py
+++ b/scripts/lib/kdoc/kdoc_files.py
@@ -12,7 +12,6 @@ import argparse
import logging
import os
import re
-import sys
from kdoc_parser import KernelDoc
from kdoc_output import OutputFormat
@@ -109,7 +108,7 @@ class KernelFiles():
KernelDoc.process_export(self.config.function_table, line)
except IOError:
- print(f"Error: Cannot open fname {fname}", fname=sys.stderr)
+ self.config.log.error("Error: Cannot open fname %s", fname)
self.config.errors += 1
def file_not_found_cb(self, fname):
@@ -262,3 +261,12 @@ class KernelFiles():
fname, ln, dtype)
if msg:
yield fname, msg
+
+ @property
+ def errors(self):
+ """
+ Return a count of the number of warnings found, including
+ the ones displayed while interacting over self.msg.
+ """
+
+ return self.config.errors