mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 10:29:52 +00:00
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
This commit is contained in:
committed by
Jonathan Corbet
parent
e4b2bd908c
commit
11afeab6d7
@@ -137,17 +137,18 @@ class KernelDoc:
|
||||
|
||||
log_msg = f"{self.fname}:{ln} {msg}"
|
||||
|
||||
if not warning:
|
||||
self.config.log.info(log_msg)
|
||||
return
|
||||
|
||||
if self.entry:
|
||||
# Delegate warning output to output logic, as this way it
|
||||
# will report warnings/info only for symbols that are output
|
||||
|
||||
self.entry.warnings.append((warning, log_msg))
|
||||
self.entry.warnings.append(log_msg)
|
||||
return
|
||||
|
||||
if warning:
|
||||
self.config.log.warning(log_msg)
|
||||
else:
|
||||
self.config.log.info(log_msg)
|
||||
self.config.log.warning(log_msg)
|
||||
|
||||
def dump_section(self, start_new=True):
|
||||
"""
|
||||
@@ -556,7 +557,6 @@ class KernelDoc:
|
||||
|
||||
if not members:
|
||||
self.emit_warning(ln, f"{proto} error: Cannot parse struct or union!")
|
||||
self.config.errors += 1
|
||||
return
|
||||
|
||||
if self.entry.identifier != declaration_name:
|
||||
@@ -831,7 +831,6 @@ class KernelDoc:
|
||||
|
||||
if not members:
|
||||
self.emit_warning(ln, f"{proto}: error: Cannot parse enum!")
|
||||
self.config.errors += 1
|
||||
return
|
||||
|
||||
if self.entry.identifier != declaration_name:
|
||||
@@ -1132,7 +1131,6 @@ class KernelDoc:
|
||||
return
|
||||
|
||||
self.emit_warning(ln, "error: Cannot parse typedef!")
|
||||
self.config.errors += 1
|
||||
|
||||
@staticmethod
|
||||
def process_export(function_table, line):
|
||||
@@ -1677,4 +1675,3 @@ class KernelDoc:
|
||||
self.process_docblock(ln, line)
|
||||
except OSError:
|
||||
self.config.log.error(f"Error: Cannot open file {self.fname}")
|
||||
self.config.errors += 1
|
||||
|
||||
Reference in New Issue
Block a user