Lines Matching +full:sub +full:- +full:spaces
2 # SPDX-License-Identifier: GPL-2.0
10 ## Copyright (C) 2005-2012 Randy Dunlap ##
22 kernel-doc - Print formatted kernel documentation to stdout
26 …kernel-doc [-h] [-v] [-Werror] [-Wall] [-Wreturn] [-Wshort-description] [-Wcontents-before-section…
27 [ -man |
28 -rst [-sphinx-version VERSION] [-enable-lineno] |
29 -none
32 -export |
33 -internal |
34 [-function NAME] ... |
35 [-nosymbol NAME] ...
37 [-no-doc-sections]
38 [-export-file FILE] ...
41 Run `kernel-doc -h` for details.
50 See Documentation/doc-guide/kernel-doc.rst for the documentation comment syntax.
64 my $type_constant2 = '\%([-_\w]+)';
66 my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
67 my $type_param_ref = '([\!~]?)\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
69 my $type_fp_param2 = '\@(\w+->\S+)\(\)'; # Special RST handling for structs with func ptr params
75 my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
98 # rst-mode
119 if ($#ARGV == -1) {
121 -message => "No arguments!\n",
122 -exitval => 1,
123 -verbose => 99,
124 -sections => 'SYNOPSIS',
125 -output => \*STDERR,
151 OUTPUT_INTERNAL => 3, # output non-exported symbols
160 (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
199 # other environment variables are converted to command-line
203 # docbook v3.1 requires a non-zero sequence of RefEntry's; see:
204 # https://www.oasis-open.org/docbook/documentation/reference/html/refentry.html
216 STATE_BODY_MAYBE => 2, # body - or maybe more description
233 STATE_INLINE_ERROR => 4, # error - Comment without header was found.
235 # proper kernel-doc and ignore the rest.
243 # Name of the kernel-doc identifier for non-DOC markups
255 # @{section-name}:
269 my $attribute = qr{__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)}i;
290 my $undescribed = "-- undescribed --";
294 while ($ARGV[0] =~ m/^--?(.*)/) {
319 } elsif ($cmd eq "internal") { # only non-exported symbols
322 } elsif ($cmd eq "export-file") {
331 } elsif ($cmd eq "Wshort-desc") {
333 } elsif ($cmd eq "Wcontents-before-sections") {
340 pod2usage(-exitval => 0, -verbose => 2);
341 } elsif ($cmd eq 'no-doc-sections') {
343 } elsif ($cmd eq 'enable-lineno') {
345 } elsif ($cmd eq 'show-not-found') {
346 $show_not_found = 1; # A no-op but don't fail
347 } elsif ($cmd eq "sphinx-version") {
367 -message => "Argument unknown!\n",
368 -exitval => 1,
369 -verbose => 99,
370 -sections => 'SYNOPSIS',
371 -output => \*STDERR,
376 -message => "FILE argument missing\n",
377 -exitval => 1,
378 -verbose => 99,
379 -sections => 'SYNOPSIS',
380 -output => \*STDERR,
389 sub findprog($)
392 return "$_/$_[0]" if(-x "$_/$_[0]");
396 sub get_sphinx_version()
400 my $cmd = "sphinx-build";
402 my $cmd = "sphinx-build3";
413 open IN, "$cmd --version 2>&1 |";
415 if (m/^\s*sphinx-build\s+([\d]+)\.([\d\.]+)(\+\/[\da-f]+)?$/) {
433 sub get_kernel_version() {
443 sub print_lineno {
450 sub emit_warning {
459 sub dump_section {
495 sub dump_doc_section {
514 'content-only' => ($output_selection != OUTPUT_ALL), });
529 sub output_highlight {
565 sub output_function_man(%) {
573 print $args{'function'} . " \\- " . $args{'purpose'} . "\n";
590 # pointer-to-function
616 sub output_enum_man(%) {
624 print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n";
657 sub output_struct_man(%) {
664 print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";
692 sub output_typedef_man(%) {
699 print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n";
707 sub output_blockhead_man(%) {
729 sub output_blockhead_rst(%) {
747 # Apply the RST highlights to a sub-block of text.
749 sub highlight_block($) {
761 my $sphinx_cblock = '^\.\.\ +code-block::';
763 sub output_highlight_rst {
779 # If this is the first non-blank line in a literal
817 sub output_function_rst(%) {
870 # pointer-to-function
923 sub output_section_rst(%) {
937 sub output_enum_rst(%) {
975 sub output_typedef_rst(%) {
996 sub output_struct_rst(%) {
1049 sub output_function_none(%) {
1052 sub output_enum_none(%) {
1055 sub output_typedef_none(%) {
1058 sub output_struct_none(%) {
1061 sub output_blockhead_none(%) {
1068 sub output_declaration {
1089 # generic output function - calls the right one based on current output mode.
1090 sub output_blockhead {
1100 sub dump_declaration($$) {
1107 sub dump_union($$) {
1111 sub dump_struct($$) {
1151 # - first eat non-declaration parameters and rewrite for final match
1152 # - then remove macro, outer parens, and trailing semicolon
1164 $members =~ s/DECLARE_HASHTABLE\s*\($args,\s*$args\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
1191 # pointer-to-function
1214 # So, we remove spaces when parsing the
1261 $level-- if ($clause =~ m/(\})/ && $level > 1);
1289 sub show_warnings($$) {
1321 sub dump_enum($$) {
1345 emit_warning("${file}:$.", "wrong kernel-doc identifier on line:\n");
1401 sub dump_typedef($$) {
1465 sub save_struct_actual($) {
1468 # strip all spaces from the actual param so that it looks like one string item
1473 sub create_parameterlist($$$$) {
1492 # strip leading/trailing spaces
1503 # pointer-to-function
1539 if ($type ne "") { # skip unnamed bit-fields
1553 sub push_parameter($$$$$) {
1608 # strip spaces from $param so that it is one continuous string
1622 sub check_sections($$$$$) {
1638 # spaces, e.g.: addr[6 + 2]
1640 # parameter list is split at spaces;
1663 sub check_return_section {
1686 sub dump_function($$) {
1735 # - parport_register_device (function pointer parameters)
1736 # - atomic_set (macro)
1737 # - pci_match_device, __copy_to_user (long return type)
1738 my $name = qr{[a-zA-Z0-9_~:]+};
1746 # This is an object-like macro, it has no return type and no parameter
1748 # Function-like macros are not allowed to have spaces between
1777 # -Wreturn mode.
1815 sub reset_state {
1830 sub tracepoint_munge($) {
1857 sub syscall_munge() {
1861 ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
1874 # now delete all of the odd-number commas in $prototype
1879 $len = 0; # skip the for-loop
1891 sub process_proto_function($$) {
1895 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
1907 $prototype =~ s@^\s+@@gos; # strip leading spaces
1926 sub process_proto_type($$) {
1931 $x =~ s@^\s+@@gos; # strip leading spaces
1932 $x =~ s@\s+$@@gos; # strip trailing spaces
1933 $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line
1947 ($2 eq '}') && $brcount--;
1962 sub map_filename($) {
1979 sub process_export_file($) {
2008 sub process_normal() {
2017 # STATE_NAME: Looking for the "name - description" line
2019 sub process_name($$) {
2037 # test for pointer declaration type, foo * bar() - desc
2040 my $decl_end = qr{[-:].*};
2049 # Look for foo() or static void foo() - description; or misspelt
2066 if (/[-:](.*)/) {
2067 # strip leading/trailing/multiple spaces
2079 …"This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/ker…
2088 emit_warning("${file}:$.", "wrong kernel-doc identifier on line:\n$_");
2096 emit_warning("${file}:$.", "Cannot understand $_ on line $. - I thought it was a doc line\n");
2105 sub process_body($$) {
2158 if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') {
2202 # i dont know - bad line? ignore.
2211 sub process_proto($$) {
2236 sub process_docblock($$) {
2263 sub process_inline($$) {
2297 emit_warning("${file}:$.", "Incorrect use of kernel-doc format: $_");
2303 sub process_file($) {
2323 # Replace tabs by spaces
2324 while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
2422 =item -man
2426 =item -rst
2430 =item -none
2442 =item -sphinx-version VERSION
2446 If not specified, kernel-doc will auto-detect using the sphinx-build version
2455 =item -export
2458 EXPORT_SYMBOL() and related macros in any input FILE or -export-file FILE.
2460 =item -internal
2463 EXPORT_SYMBOL() and related macros in any input FILE or -export-file FILE.
2465 =item -function NAME
2472 =item -nosymbol NAME
2484 =item -no-doc-sections
2488 =item -export-file FILE
2492 To be used with -export or -internal.
2502 =item -enable-lineno
2512 =item -h, -help
2516 =item -v
2520 =item -Werror