Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: kdoc: Regularize the use of the declaration name

Each declaration type passes through the name in a unique field of the
"args" blob - even though we have always just passed the name separately.
Get rid of all the weird names and just use the common version.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

+15 -30
+15 -24
scripts/lib/kdoc/kdoc_output.py
··· 367 367 368 368 func_macro = args.get('func_macro', False) 369 369 if func_macro: 370 - signature = args['function'] 370 + signature = name 371 371 else: 372 372 if args.get('functiontype'): 373 373 signature = args['functiontype'] + " " 374 - signature += args['function'] + " (" 374 + signature += name + " (" 375 375 376 376 ln = args.get('declaration_start_line', 0) 377 377 count = 0 ··· 391 391 392 392 self.print_lineno(ln) 393 393 if args.get('typedef') or not args.get('functiontype'): 394 - self.data += f".. c:macro:: {args['function']}\n\n" 394 + self.data += f".. c:macro:: {name}\n\n" 395 395 396 396 if args.get('typedef'): 397 397 self.data += " **Typedef**: " ··· 445 445 def out_enum(self, fname, name, args): 446 446 447 447 oldprefix = self.lineprefix 448 - name = args.get('enum', '') 449 448 ln = args.get('declaration_start_line', 0) 450 449 451 450 self.data += f"\n\n.. c:enum:: {name}\n\n" ··· 474 475 def out_typedef(self, fname, name, args): 475 476 476 477 oldprefix = self.lineprefix 477 - name = args.get('typedef', '') 478 478 ln = args.get('declaration_start_line', 0) 479 479 480 480 self.data += f"\n\n.. c:type:: {name}\n\n" ··· 490 492 491 493 def out_struct(self, fname, name, args): 492 494 493 - name = args.get('struct', "") 494 495 purpose = args.get('purpose', "") 495 496 declaration = args.get('definition', "") 496 497 dtype = args.get('type', "struct") ··· 629 632 def out_function(self, fname, name, args): 630 633 """output function in man""" 631 634 632 - self.data += f'.TH "{args["function"]}" 9 "{args["function"]}" "{self.man_date}" "Kernel Hacker\'s Manual" LINUX' + "\n" 635 + self.data += f'.TH "{name}" 9 "{name}" "{self.man_date}" "Kernel Hacker\'s Manual" LINUX' + "\n" 633 636 634 637 self.data += ".SH NAME\n" 635 - self.data += f"{args['function']} \\- {args['purpose']}\n" 638 + self.data += f"{name} \\- {args['purpose']}\n" 636 639 637 640 self.data += ".SH SYNOPSIS\n" 638 641 if args.get('functiontype', ''): 639 - self.data += f'.B "{args["functiontype"]}" {args["function"]}' + "\n" 642 + self.data += f'.B "{args["functiontype"]}" {name}' + "\n" 640 643 else: 641 - self.data += f'.B "{args["function"]}' + "\n" 644 + self.data += f'.B "{name}' + "\n" 642 645 643 646 count = 0 644 647 parenth = "(" ··· 673 676 self.output_highlight(text) 674 677 675 678 def out_enum(self, fname, name, args): 676 - 677 - name = args.get('enum', '') 678 - 679 - self.data += f'.TH "{self.modulename}" 9 "enum {args["enum"]}" "{self.man_date}" "API Manual" LINUX' + "\n" 679 + self.data += f'.TH "{self.modulename}" 9 "enum {name}" "{self.man_date}" "API Manual" LINUX' + "\n" 680 680 681 681 self.data += ".SH NAME\n" 682 - self.data += f"enum {args['enum']} \\- {args['purpose']}\n" 682 + self.data += f"enum {name} \\- {args['purpose']}\n" 683 683 684 684 self.data += ".SH SYNOPSIS\n" 685 - self.data += f"enum {args['enum']}" + " {\n" 685 + self.data += f"enum {name}" + " {\n" 686 686 687 687 count = 0 688 688 for parameter in args.parameterlist: ··· 704 710 705 711 def out_typedef(self, fname, name, args): 706 712 module = self.modulename 707 - typedef = args.get('typedef') 708 713 purpose = args.get('purpose') 709 714 710 - self.data += f'.TH "{module}" 9 "{typedef}" "{self.man_date}" "API Manual" LINUX' + "\n" 715 + self.data += f'.TH "{module}" 9 "{name}" "{self.man_date}" "API Manual" LINUX' + "\n" 711 716 712 717 self.data += ".SH NAME\n" 713 - self.data += f"typedef {typedef} \\- {purpose}\n" 718 + self.data += f"typedef {name} \\- {purpose}\n" 714 719 715 720 for section, text in args.sections.items(): 716 721 self.data += f'.SH "{section}"' + "\n" ··· 717 724 718 725 def out_struct(self, fname, name, args): 719 726 module = self.modulename 720 - struct_type = args.get('type') 721 - struct_name = args.get('struct') 722 727 purpose = args.get('purpose') 723 728 definition = args.get('definition') 724 729 725 - self.data += f'.TH "{module}" 9 "{struct_type} {struct_name}" "{self.man_date}" "API Manual" LINUX' + "\n" 730 + self.data += f'.TH "{module}" 9 "{args.type} {name}" "{self.man_date}" "API Manual" LINUX' + "\n" 726 731 727 732 self.data += ".SH NAME\n" 728 - self.data += f"{struct_type} {struct_name} \\- {purpose}\n" 733 + self.data += f"{args.type} {name} \\- {purpose}\n" 729 734 730 735 # Replace tabs with two spaces and handle newlines 731 736 declaration = definition.replace("\t", " ") 732 737 declaration = KernRe(r"\n").sub('"\n.br\n.BI "', declaration) 733 738 734 739 self.data += ".SH SYNOPSIS\n" 735 - self.data += f"{struct_type} {struct_name} " + "{" + "\n.br\n" 740 + self.data += f"{args.type} {name} " + "{" + "\n.br\n" 736 741 self.data += f'.BI "{declaration}\n' + "};\n.br\n\n" 737 742 738 743 self.data += ".SH Members\n"
-6
scripts/lib/kdoc/kdoc_parser.py
··· 790 790 level += 1 791 791 792 792 self.output_declaration(decl_type, declaration_name, 793 - struct=declaration_name, 794 793 definition=declaration, 795 794 purpose=self.entry.declaration_purpose) 796 795 ··· 869 870 f"Excess enum value '%{k}' description in '{declaration_name}'") 870 871 871 872 self.output_declaration('enum', declaration_name, 872 - enum=declaration_name, 873 873 purpose=self.entry.declaration_purpose) 874 874 875 875 def dump_declaration(self, ln, prototype): ··· 1029 1031 1030 1032 if 'typedef' in return_type: 1031 1033 self.output_declaration(decl_type, declaration_name, 1032 - function=declaration_name, 1033 1034 typedef=True, 1034 1035 functiontype=return_type, 1035 1036 purpose=self.entry.declaration_purpose, 1036 1037 func_macro=func_macro) 1037 1038 else: 1038 1039 self.output_declaration(decl_type, declaration_name, 1039 - function=declaration_name, 1040 1040 typedef=False, 1041 1041 functiontype=return_type, 1042 1042 purpose=self.entry.declaration_purpose, ··· 1073 1077 self.create_parameter_list(ln, decl_type, args, ',', declaration_name) 1074 1078 1075 1079 self.output_declaration(decl_type, declaration_name, 1076 - function=declaration_name, 1077 1080 typedef=True, 1078 1081 functiontype=return_type, 1079 1082 purpose=self.entry.declaration_purpose) ··· 1094 1099 return 1095 1100 1096 1101 self.output_declaration('typedef', declaration_name, 1097 - typedef=declaration_name, 1098 1102 purpose=self.entry.declaration_purpose) 1099 1103 return 1100 1104