Lines Matching +full:sub +full:- +full:module

2 # SPDX-License-Identifier: GPL-2.0
10 ## Copyright (C) 2005-2012 Randy Dunlap ##
19 # 18/01/2001 - Cleanups
22 # -- huggie@earth.li
24 # 27/06/2001 - Allowed whitespace after initial "/**" and
26 # -- Christian Kreibich <ck@whoop.org>
29 # - add perldoc documentation
30 # - Look more closely at some of the scarier bits :)
32 # 26/05/2001 - Support for separate source and object trees.
36 # 23/09/2001 - Added support for typedefs, structs, enums and unions
39 # -- Tim Jansen <tim@tjansen.de>
41 # 25/07/2012 - Added support for HTML5
42 # -- Dan Luedtke <mail@danrl.de>
44 sub usage {
52 Documentation/doc-guide/kernel-doc.rst for the documentation comment syntax.
55 -man Output troff manual page format. This is the default.
56 -rst Output reStructuredText format.
57 -none Do not output documentation, only warnings.
61 -sphinx-version Use the ReST C domain dialect compatible with an
63 If not specified, kernel-doc will auto-detect using
64 the sphinx-build version found on PATH.
67 -export Only output documentation for symbols that have been
69 in any input FILE or -export-file FILE.
70 -internal Only output documentation for symbols that have NOT been
72 in any input FILE or -export-file FILE.
73 -function NAME Only output documentation for the given function(s)
76 -nosymbol NAME Exclude the specified symbols from the output
80 -no-doc-sections Do not output DOC: sections.
81 -enable-lineno Enable output of #define LINENO lines. Only works with
83 -export-file FILE Specify an additional FILE in which to look for
85 -export or -internal. May be specified multiple times.
88 -v Verbose output, more warnings and other information.
89 -h Print this help.
90 -Werror Treat warnings as errors.
102 # * function_name(:)? (- short description)?
119 # * my_function - does my stuff
127 # * my_function - does my stuff
140 # * struct my_struct - short description
159 # * struct my_struct - short description
183 # A non-void function should have a "Return:" section describing the return
185 # Example-sections should contain the string EXAMPLE so that they are marked
190 # * user_function - function that can only be called in user context
204 # 'funcname()' - function
205 # '$ENVVAR' - environmental variable
206 # '&struct_name' - name of a structure (up to two words including 'struct')
207 # '&struct_name.member' - name of a structure member
208 # '@parameter' - name of a parameter
209 # '%CONST' - name of a constant.
210 # '``LITERAL``' - literal string without any spaces on it.
220 my $type_constant2 = '\%([-_\w]+)';
222 my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
223 my $type_param_ref = '([\!]?)\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
225 my $type_fp_param2 = '\@(\w+->\S+)\(\)'; # Special RST handling for structs with func ptr params
231 my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
254 # rst-mode
275 if ($#ARGV == -1) {
298 OUTPUT_INTERNAL => 3, # output non-exported symbols
307 (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
345 # docbook v3.1 requires a non-zero sequence of RefEntry's; see:
346 # https://www.oasis-open.org/docbook/documentation/reference/html/refentry.html
358 STATE_BODY_MAYBE => 2, # body - or maybe more description
375 STATE_INLINE_ERROR => 4, # error - Comment without header was found.
377 # proper kernel-doc and ignore the rest.
420 my $undescribed = "-- undescribed --";
424 while ($ARGV[0] =~ m/^--?(.*)/) {
437 } elsif ($cmd eq "module") { # not needed for XML, inherits from calling document
449 } elsif ($cmd eq "internal") { # only non-exported symbols
452 } elsif ($cmd eq "export-file") {
461 } elsif ($cmd eq 'no-doc-sections') {
463 } elsif ($cmd eq 'enable-lineno') {
465 } elsif ($cmd eq 'show-not-found') {
466 $show_not_found = 1; # A no-op but don't fail
467 } elsif ($cmd eq "sphinx-version") {
494 sub findprog($)
497 return "$_/$_[0]" if(-x "$_/$_[0]");
501 sub get_sphinx_version()
505 my $cmd = "sphinx-build";
507 my $cmd = "sphinx-build3";
518 open IN, "$cmd --version 2>&1 |";
520 if (m/^\s*sphinx-build\s+([\d]+)\.([\d\.]+)(\+\/[\da-f]+)?$/) {
538 sub get_kernel_version() {
548 sub print_lineno {
557 sub dump_section {
594 sub dump_doc_section {
612 'module' => $modulename,
613 'content-only' => ($output_selection != OUTPUT_ALL), });
628 sub output_highlight {
664 sub output_function_man(%) {
672 print $args{'function'} . " \\- " . $args{'purpose'} . "\n";
689 # pointer-to-function
715 sub output_enum_man(%) {
720 print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n";
723 print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n";
756 sub output_struct_man(%) {
760 …print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \…
763 print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
791 sub output_typedef_man(%) {
795 print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n";
798 print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n";
806 sub output_blockhead_man(%) {
811 print ".TH \"$args{'module'}\" 9 \"$args{'module'}\" \"$man_date\" \"API Manual\" LINUX\n";
828 sub output_blockhead_rst(%) {
845 # Apply the RST highlights to a sub-block of text.
847 sub highlight_block($) {
859 my $sphinx_cblock = '^\.\.\ +code-block::';
861 sub output_highlight_rst {
877 # If this is the first non-blank line in a literal
915 sub output_function_rst(%) {
968 # pointer-to-function
1014 sub output_section_rst(%) {
1030 sub output_enum_rst(%) {
1064 sub output_typedef_rst(%) {
1085 sub output_struct_rst(%) {
1135 sub output_function_none(%) {
1138 sub output_enum_none(%) {
1141 sub output_typedef_none(%) {
1144 sub output_struct_none(%) {
1147 sub output_blockhead_none(%) {
1154 sub output_declaration {
1175 # generic output function - calls the right one based on current output mode.
1176 sub output_blockhead {
1186 sub dump_declaration($$) {
1193 sub dump_union($$) {
1197 sub dump_struct($$) {
1201 …|____cacheline_aligned_in_smp|____cacheline_aligned|__attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*/)…
1212 $members =~ s/\s*__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)/ /gi;
1223 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
1245 # pointer-to-function
1315 $level-- if ($clause =~ m/(\})/ && $level > 1);
1325 'module' => $modulename,
1343 sub show_warnings($$) {
1375 sub dump_enum($$) {
1421 'module' => $modulename,
1441 sub dump_typedef($$) {
1460 'module' => $modulename,
1483 'module' => $modulename,
1495 sub save_struct_actual($) {
1503 sub create_parameterlist($$$$) {
1530 # pointer-to-function
1566 if ($type ne "") { # skip unnamed bit-fields
1580 sub push_parameter($$$$$) {
1651 sub check_sections($$$$$) {
1664 $prm_clean =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i;
1693 sub check_return_section {
1717 sub dump_function($$) {
1760 # - parport_register_device (function pointer parameters)
1761 # - atomic_set (macro)
1762 # - pci_match_device, __copy_to_user (long return type)
1764 if ($define && $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s+/) {
1765 # This is an object-like macro, it has no return type and no parameter
1767 # Function-like macros are not allowed to have spaces between
1772 } elsif ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
1773 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
1774 $prototype =~ m/^(\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
1775 $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
1776 $prototype =~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
1777 $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
1778 $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||
1779 $prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1780 $prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1781 $prototype =~ m/^(\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1782 $prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1783 $prototype =~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1784 $prototype =~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1785 $prototype =~ m/^(\w+\s+\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1786 $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1787 $prototype =~ m/^(\w+\s+\w+\s+\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ ||
1788 $prototype =~ m/^(\w+\s+\w+\s*\*+\s*\w+\s*\*+\s*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/) {
1818 'module' => $modulename,
1831 'module' => $modulename,
1843 sub reset_state {
1858 sub tracepoint_munge($) {
1884 sub syscall_munge() {
1888 ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
1901 # now delete all of the odd-number commas in $prototype
1906 $len = 0; # skip the for-loop
1918 sub process_proto_function($$) {
1922 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
1953 sub process_proto_type($$) {
1960 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
1974 ($2 eq '}') && $brcount--;
1989 sub map_filename($) {
2006 sub process_export_file($) {
2031 sub process_normal() {
2040 # STATE_NAME: Looking for the "name - description" line
2042 sub process_name($$) {
2060 if (/\s*([\w\s]+?)(\(\))?\s*-/) {
2070 if (/-(.*)/) {
2105 " - I thought it was a doc line\n";
2115 sub process_body($$) {
2181 if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') {
2226 # i dont know - bad line? ignore.
2236 sub process_proto($$) {
2261 sub process_docblock($$) {
2288 sub process_inline($$) {
2323 print STDERR "Incorrect use of kernel-doc format: $_";
2330 sub process_file($) {
2351 while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};