History

kernel-doc: output source file name at SEE ALSO

for man pages, it is helpful to know from where the man page were generated.

Mauro Carvalho Chehab committed 1 year ago

Commit 2bd22191 parent 0a4cd1c3 files · +9 −5Browse files

Showing the changes to scripts (3 of 3 files). Show all

Unified · Split

3 files
  1. scripts/lib/kdoc/kdoc_item.py +2 −1
  2. scripts/lib/kdoc/kdoc_output.py +2 −1
  3. scripts/lib/kdoc/kdoc_parser.py +5 −3
scripts/lib/kdoc/kdoc_item.py+2−1
@@ -5,8 +5,9 @@ · 4 unmodified lines
5#5#
6 6
7class KdocItem:7class KdocItem:
8 def __init__(self, name, type, start_line, **other_stuff):8 def __init__(self, name, fname, type, start_line, **other_stuff):
9 self.name = name9 self.name = name
10 self.fname = fname
10 self.type = type11 self.type = type
11 self.declaration_start_line = start_line12 self.declaration_start_line = start_line
12 self.sections = {}13 self.sections = {}
scripts/lib/kdoc/kdoc_output.py+2−1
@@ -630,10 +630,11 @@ class ManFormat(OutputFormat): · 629 unmodified lines
630 """Adds a tail for all man pages"""630 """Adds a tail for all man pages"""
631 631
632 # SEE ALSO section632 # SEE ALSO section
633 self.data += f'.SH "SEE ALSO"' + "\n.PP\n"
634 self.data += (f"Kernel file \\fB{args.fname}\\fR\n")
633 if len(self.symbols) >= 2:635 if len(self.symbols) >= 2:
634 cur_name = self.arg_name(args, name)636 cur_name = self.arg_name(args, name)
635 637
636 self.data += f'.SH "SEE ALSO"' + "\n.PP\n"
637 related = []638 related = []
638 for arg in self.symbols:639 for arg in self.symbols:
639 out_name = self.arg_name(arg, arg.name)640 out_name = self.arg_name(arg, arg.name)
scripts/lib/kdoc/kdoc_parser.py+5−3
@@ -254,8 +254,9 @@ SECTION_DEFAULT = "Description" # default section · 253 unmodified lines
254 254
255class KernelEntry:255class KernelEntry:
256 256
257 def __init__(self, config, ln):257 def __init__(self, config, fname, ln):
258 self.config = config258 self.config = config
259 self.fname = fname
259 260
260 self._contents = []261 self._contents = []
261 self.prototype = ""262 self.prototype = ""
@@ -422,7 +423,8 @@ class KernelDoc: · 160 unmodified lines
422 The actual output and output filters will be handled elsewhere423 The actual output and output filters will be handled elsewhere
423 """424 """
424 425
425 item = KdocItem(name, dtype, self.entry.declaration_start_line, **args)426 item = KdocItem(name, self.fname, dtype,
427 self.entry.declaration_start_line, **args)
426 item.warnings = self.entry.warnings428 item.warnings = self.entry.warnings
427 429
428 # Drop empty sections430 # Drop empty sections
@@ -445,7 +447,7 @@ class KernelDoc: · 16 unmodified lines
445 variables used by the state machine.447 variables used by the state machine.
446 """448 """
447 449
448 self.entry = KernelEntry(self.config, ln)450 self.entry = KernelEntry(self.config, self.fname, ln)
449 451
450 # State flags452 # State flags
451 self.state = state.NORMAL453 self.state = state.NORMAL