#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
# vim: softtabstop=4

use warnings;
use strict;

## Copyright (c) 1998 Michael Zucchi, All Rights Reserved        ##
## Copyright (C) 2000, 1  Tim Waugh <twaugh@redhat.com>          ##
## Copyright (C) 2001  Simon Huggins                             ##
## Copyright (C) 2005-2012  Randy Dunlap                         ##
## Copyright (C) 2012  Dan Luedtke                               ##
## 								 ##
## #define enhancements by Armin Kuster <akuster@mvista.com>	 ##
## Copyright (c) 2000 MontaVista Software, Inc.			 ##
#
# Copyright (C) 2022 Tomasz Warniełło (POD)

use Pod::Usage qw/pod2usage/;

=head1 NAME

kernel-doc - Print formatted kernel documentation to stdout

=head1 SYNOPSIS

 kernel-doc [-h] [-v] [-Werror] [-Wall] [-Wreturn] [-Wshort-desc[ription]] [-Wcontents-before-sections]
   [ -man |
     -rst [-sphinx-version VERSION] [-enable-lineno] |
     -none
   ]
   [
     -export |
     -internal |
     [-function NAME] ... |
     [-nosymbol NAME] ...
   ]
   [-no-doc-sections]
   [-export-file FILE] ...
   FILE ...

Run `kernel-doc -h` for details.

=head1 DESCRIPTION

Read C language source or header FILEs, extract embedded documentation comments,
and print formatted documentation to standard output.

The documentation comments are identified by the "/**" opening comment mark.

See Documentation/doc-guide/kernel-doc.rst for the documentation comment syntax.

=cut

# more perldoc at the end of the file

## init lots of data

my $errors = 0;
my $warnings = 0;
my $anon_struct_union = 0;

# match expressions used to find embedded type information
my $type_constant = '\b``([^\`]+)``\b';
my $type_constant2 = '\%([-_*\w]+)';
my $type_func = '(\w+)\(\)';
my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
my $type_param_ref = '([\!~\*]?)\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr params
my $type_fp_param2 = '\@(\w+->\S+)\(\)';  # Special RST handling for structs with func ptr params
my $type_env = '(\$\w+)';
my $type_enum = '\&(enum\s*([_\w]+))';
my $type_struct = '\&(struct\s*([_\w]+))';
my $type_typedef = '\&(typedef\s*([_\w]+))';
my $type_union = '\&(union\s*([_\w]+))';
my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
my $type_fallback = '\&([_\w]+)';
my $type_member_func = $type_member . '\(\)';

# Output conversion substitutions.
#  One for each output format

# these are pretty rough
my @highlights_man = (
    [$type_constant, "\$1"],
    [$type_constant2, "\$1"],
    [$type_func, "\\\\fB\$1\\\\fP"],
    [$type_enum, "\\\\fI\$1\\\\fP"],
    [$type_struct, "\\\\fI\$1\\\\fP"],
    [$type_typedef, "\\\\fI\$1\\\\fP"],
    [$type_union, "\\\\fI\$1\\\\fP"],
    [$type_param, "\\\\fI\$1\\\\fP"],
    [$type_param_ref, "\\\\fI\$1\$2\\\\fP"],
    [$type_member, "\\\\fI\$1\$2\$3\\\\fP"],
    [$type_fallback, "\\\\fI\$1\\\\fP"]
  );
my $blankline_man = "";

# rst-mode
my @highlights_rst = (
    [$type_constant, "``\$1``"],
    [$type_constant2, "``\$1``"],

    # Note: need to escape () to avoid func matching later
    [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"],
    [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"],
    [$type_fp_param, "**\$1\\\\(\\\\)**"],
    [$type_fp_param2, "**\$1\\\\(\\\\)**"],
    [$type_func, "\$1()"],
    [$type_enum, "\\:c\\:type\\:`\$1 <\$2>`"],
    [$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"],
    [$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"],
    [$type_union, "\\:c\\:type\\:`\$1 <\$2>`"],

    # in rst this can refer to any type
    [$type_fallback, "\\:c\\:type\\:`\$1`"],
    [$type_param_ref, "**\$1\$2**"]
  );
my $blankline_rst = "\n";

# read arguments
if ($#ARGV == -1) {
    pod2usage(
        -message => "No arguments!\n",
        -exitval => 1,
        -verbose => 99,
        -sections => 'SYNOPSIS',
        -output => \*STDERR,
      );
}

my $kernelversion;
my ($sphinx_major, $sphinx_minor, $sphinx_patch);

my $dohighlight = "";

my $verbose = 0;
my $Werror = 0;
my $Wreturn = 0;
my $Wshort_desc = 0;
my $Wcontents_before_sections = 0;
my $output_mode = "rst";
my $output_preformatted = 0;
my $no_doc_sections = 0;
my $enable_lineno = 0;
my @highlights = @highlights_rst;
my $blankline = $blankline_rst;
my $modulename = "Kernel API";

use constant {
    OUTPUT_ALL          => 0, # output all symbols and doc sections
    OUTPUT_INCLUDE      => 1, # output only specified symbols
    OUTPUT_EXPORTED     => 2, # output exported symbols
    OUTPUT_INTERNAL     => 3, # output non-exported symbols
};
my $output_selection = OUTPUT_ALL;
my $show_not_found = 0;	# No longer used

my @export_file_list;

my @build_time;
if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) &&
    (my $seconds = `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '') {
    @build_time = gmtime($seconds);
} else {
    @build_time = localtime;
}

my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
                'July', 'August', 'September', 'October',
                'November', 'December')[$build_time[4]] .
    " " . ($build_time[5]+1900);

# Essentially these are globals.
# They probably want to be tidied up, made more localised or something.
# CAVEAT EMPTOR!  Some of the others I localised may not want to be, which
# could cause "use of undefined value" or other bugs.
my ($function, %function_table, %parametertypes, $declaration_purpose);
my %nosymbol_table = ();
my $declaration_start_line;
my ($type, $declaration_name, $return_type);
my ($newsection, $newcontents, $prototype, $brcount, %source_map);

if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
    $verbose = 1;
}

if (defined($ENV{'KCFLAGS'})) {
    my $kcflags = "$ENV{'KCFLAGS'}";

    if ($kcflags =~ /(\s|^)-Werror(\s|$)/) {
        $Werror = 1;
    }
}

# reading this variable is for backwards compat just in case
# someone was calling it with the variable from outside the
# kernel's build system
if (defined($ENV{'KDOC_WERROR'})) {
    $Werror = "$ENV{'KDOC_WERROR'}";
}
# other environment variables are converted to command-line
# arguments in cmd_checkdoc in the build system

# Generated docbook code is inserted in a template at a point where
# docbook v3.1 requires a non-zero sequence of RefEntry's; see:
# https://www.oasis-open.org/docbook/documentation/reference/html/refentry.html
# We keep track of number of generated entries and generate a dummy
# if needs be to ensure the expanded template can be postprocessed
# into html.
my $section_counter = 0;

my $lineprefix="";

# Parser states
use constant {
    STATE_NORMAL        => 0,        # normal code
    STATE_NAME          => 1,        # looking for function name
    STATE_BODY_MAYBE    => 2,        # body - or maybe more description
    STATE_BODY          => 3,        # the body of the comment
    STATE_BODY_WITH_BLANK_LINE => 4, # the body, which has a blank line
    STATE_PROTO         => 5,        # scanning prototype
    STATE_DOCBLOCK      => 6,        # documentation block
    STATE_INLINE        => 7,        # gathering doc outside main block
};
my $state;
my $in_doc_sect;
my $leading_space;

# Inline documentation state
use constant {
    STATE_INLINE_NA     => 0, # not applicable ($state != STATE_INLINE)
    STATE_INLINE_NAME   => 1, # looking for member name (@foo:)
    STATE_INLINE_TEXT   => 2, # looking for member documentation
    STATE_INLINE_END    => 3, # done
    STATE_INLINE_ERROR  => 4, # error - Comment without header was found.
                              # Spit a warning as it's not
                              # proper kernel-doc and ignore the rest.
};
my $inline_doc_state;

#declaration types: can be
# 'function', 'struct', 'union', 'enum', 'typedef'
my $decl_type;

# Name of the kernel-doc identifier for non-DOC markups
my $identifier;

my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
my $doc_end = '\*/';
my $doc_com = '\s*\*\s*';
my $doc_com_body = '\s*\* ?';
my $doc_decl = $doc_com . '(\w+)';
# @params and a strictly limited set of supported section names
# Specifically:
#   Match @word:
#	  @...:
#         @{section-name}:
# while trying to not match literal block starts like "example::"
#
my $doc_sect = $doc_com .
    '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:([^:].*)?$';
my $doc_content = $doc_com_body . '(.*)';
my $doc_block = $doc_com . 'DOC:\s*(.*)?';
my $doc_inline_start = '^\s*/\*\*\s*$';
my $doc_inline_sect = '\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)';
my $doc_inline_end = '^\s*\*/\s*$';
my $doc_inline_oneline = '^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$';
my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';
my $export_symbol_ns = '^\s*EXPORT_SYMBOL_NS(_GPL)?\s*\(\s*(\w+)\s*,\s*\w+\)\s*;';
my $function_pointer = qr{([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)};
my $attribute = qr{__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)}i;

my %parameterdescs;
my %parameterdesc_start_lines;
my @parameterlist;
my %sections;
my @sectionlist;
my %section_start_lines;
my $sectcheck;
my $struct_actual;

my $contents = "";
my $new_start_line = 0;

# the canonical section names. see also $doc_sect above.
my $section_default = "Description";	# default section
my $section_intro = "Introduction";
my $section = $section_default;
my $section_context = "Context";
my $section_return = "Return";

my $undescribed = "-- undescribed --";

reset_state();

while ($ARGV[0] =~ m/^--?(.*)/) {
    my $cmd = $1;
    shift @ARGV;
    if ($cmd eq "man") {
        $output_mode = "man";
        @highlights = @highlights_man;
        $blankline = $blankline_man;
    } elsif ($cmd eq "rst") {
        $output_mode = "rst";
        @highlights = @highlights_rst;
        $blankline = $blankline_rst;
    } elsif ($cmd eq "none") {
        $output_mode = "none";
    } elsif ($cmd eq "module") { # not needed for XML, inherits from calling document
        $modulename = shift @ARGV;
    } elsif ($cmd eq "function") { # to only output specific functions
        $output_selection = OUTPUT_INCLUDE;
        $function = shift @ARGV;
        $function_table{$function} = 1;
    } elsif ($cmd eq "nosymbol") { # Exclude specific symbols
        my $symbol = shift @ARGV;
        $nosymbol_table{$symbol} = 1;
    } elsif ($cmd eq "export") { # only exported symbols
        $output_selection = OUTPUT_EXPORTED;
        %function_table = ();
    } elsif ($cmd eq "internal") { # only non-exported symbols
        $output_selection = OUTPUT_INTERNAL;
        %function_table = ();
    } elsif ($cmd eq "export-file") {
        my $file = shift @ARGV;
        push(@export_file_list, $file);
    } elsif ($cmd eq "v") {
        $verbose = 1;
    } elsif ($cmd eq "Werror") {
        $Werror = 1;
    } elsif ($cmd eq "Wreturn") {
        $Wreturn = 1;
    } elsif ($cmd eq "Wshort-desc" or $cmd eq "Wshort-description") {
        $Wshort_desc = 1;
    } elsif ($cmd eq "Wcontents-before-sections") {
        $Wcontents_before_sections = 1;
    } elsif ($cmd eq "Wall") {
        $Wreturn = 1;
        $Wshort_desc = 1;
        $Wcontents_before_sections = 1;
    } elsif (($cmd eq "h") || ($cmd eq "help")) {
        pod2usage(-exitval => 0, -verbose => 2);
    } elsif ($cmd eq 'no-doc-sections') {
        $no_doc_sections = 1;
    } elsif ($cmd eq 'enable-lineno') {
        $enable_lineno = 1;
    } elsif ($cmd eq 'show-not-found') {
        $show_not_found = 1;  # A no-op but don't fail
    } elsif ($cmd eq "sphinx-version") {
        my $ver_string = shift @ARGV;
        if ($ver_string =~ m/^(\d+)(\.\d+)?(\.\d+)?/) {
            $sphinx_major = $1;
            if (defined($2)) {
                $sphinx_minor = substr($2,1);
            } else {
                $sphinx_minor = 0;
            }
            if (defined($3)) {
                $sphinx_patch = substr($3,1)
            } else {
                $sphinx_patch = 0;
            }
        } else {
            die "Sphinx version should either major.minor or major.minor.patch format\n";
        }
    } else {
        # Unknown argument
        pod2usage(
            -message => "Argument unknown!\n",
            -exitval => 1,
            -verbose => 99,
            -sections => 'SYNOPSIS',
            -output => \*STDERR,
            );
    }
    if ($#ARGV < 0){
        pod2usage(
            -message => "FILE argument missing\n",
            -exitval => 1,
            -verbose => 99,
            -sections => 'SYNOPSIS',
            -output => \*STDERR,
            );
    }
}

# continue execution near EOF;

# The C domain dialect changed on Sphinx 3. So, we need to check the
# version in order to produce the right tags.
sub findprog($)
{
    foreach(split(/:/, $ENV{PATH})) {
        return "$_/$_[0]" if(-x "$_/$_[0]");
    }
}

sub get_sphinx_version()
{
    my $ver;

    my $cmd = "sphinx-build";
    if (!findprog($cmd)) {
        my $cmd = "sphinx-build3";
        if (!findprog($cmd)) {
            $sphinx_major = 1;
            $sphinx_minor = 2;
            $sphinx_patch = 0;
            printf STDERR "Warning: Sphinx version not found. Using default (Sphinx version %d.%d.%d)\n",
                   $sphinx_major, $sphinx_minor, $sphinx_patch;
            return;
        }
    }

    open IN, "$cmd --version 2>&1 |";
    while (<IN>) {
        if (m/^\s*sphinx-build\s+([\d]+)\.([\d\.]+)(\+\/[\da-f]+)?$/) {
            $sphinx_major = $1;
            $sphinx_minor = $2;
            $sphinx_patch = $3;
            last;
        }
        # Sphinx 1.2.x uses a different format
        if (m/^\s*Sphinx.*\s+([\d]+)\.([\d\.]+)$/) {
            $sphinx_major = $1;
            $sphinx_minor = $2;
            $sphinx_patch = $3;
            last;
        }
    }
    close IN;
}

# get kernel version from env
sub get_kernel_version() {
    my $version = 'unknown kernel version';

    if (defined($ENV{'KERNELVERSION'})) {
        $version = $ENV{'KERNELVERSION'};
    }
    return $version;
}

#
sub print_lineno {
    my $lineno = shift;
    if ($enable_lineno && defined($lineno)) {
        print ".. LINENO " . $lineno . "\n";
    }
}

sub emit_warning {
    my $location = shift;
    my $msg = shift;
    print STDERR "$location: warning: $msg";
    ++$warnings;
}
##
# dumps section contents to arrays/hashes intended for that purpose.
#
sub dump_section {
    my $file = shift;
    my $name = shift;
    my $contents = join "\n", @_;

    if ($name =~ m/$type_param/) {
        $name = $1;
        $parameterdescs{$name} = $contents;
        $sectcheck = $sectcheck . $name . " ";
        $parameterdesc_start_lines{$name} = $new_start_line;
        $new_start_line = 0;
    } elsif ($name eq "@\.\.\.") {
        $name = "...";
        $parameterdescs{$name} = $contents;
        $sectcheck = $sectcheck . $name . " ";
        $parameterdesc_start_lines{$name} = $new_start_line;
        $new_start_line = 0;
    } else {
        if (defined($sections{$name}) && ($sections{$name} ne "")) {
            # Only warn on user specified duplicate section names.
            if ($name ne $section_default) {
                emit_warning("${file}:$.", "duplicate section name '$name'\n");
            }
            $sections{$name} .= $contents;
        } else {
            $sections{$name} = $contents;
            push @sectionlist, $name;
            $section_start_lines{$name} = $new_start_line;
            $new_start_line = 0;
        }
    }
}

##
# dump DOC: section after checking that it should go out
#
sub dump_doc_section {
    my $file = shift;
    my $name = shift;
    my $contents = join "\n", @_;

    if ($no_doc_sections) {
        return;
    }

    return if (defined($nosymbol_table{$name}));

    if (($output_selection == OUTPUT_ALL) ||
        (($output_selection == OUTPUT_INCLUDE) &&
         defined($function_table{$name})))
    {
        dump_section($file, $name, $contents);
        output_blockhead({'sectionlist' => \@sectionlist,
                          'sections' => \%sections,
                          'module' => $modulename,
                          'content-only' => ($output_selection != OUTPUT_ALL), });
    }
}

##
# output function
#
# parameterdescs, a hash.
#  function => "function name"
#  parameterlist => @list of parameters
#  parameterdescs => %parameter descriptions
#  sectionlist => @list of sections
#  sections => %section descriptions
#

sub output_highlight {
    my $contents = join "\n",@_;
    my $line;

#   DEBUG
#   if (!defined $contents) {
#	use Carp;
#	confess "output_highlight got called with no args?\n";
#   }

#   print STDERR "contents b4:$contents\n";
    eval $dohighlight;
    die $@ if $@;
#   print STDERR "contents af:$contents\n";

    foreach $line (split "\n", $contents) {
        if (! $output_preformatted) {
            $line =~ s/^\s*//;
        }
        if ($line eq ""){
            if (! $output_preformatted) {
                print $lineprefix, $blankline;
            }
        } else {
            if ($output_mode eq "man" && substr($line, 0, 1) eq ".") {
                print "\\&$line";
            } else {
                print $lineprefix, $line;
            }
        }
        print "\n";
    }
}

##
# output function in man
sub output_function_man(%) {
    my %args = %{$_[0]};
    my ($parameter, $section);
    my $count;

    print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\" \"Kernel Hacker's Manual\" LINUX\n";

    print ".SH NAME\n";
    print $args{'function'} . " \\- " . $args{'purpose'} . "\n";

    print ".SH SYNOPSIS\n";
    if ($args{'functiontype'} ne "") {
        print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n";
    } else {
        print ".B \"" . $args{'function'} . "\n";
    }
    $count = 0;
    my $parenth = "(";
    my $post = ",";
    foreach my $parameter (@{$args{'parameterlist'}}) {
        if ($count == $#{$args{'parameterlist'}}) {
            $post = ");";
        }
        $type = $args{'parametertypes'}{$parameter};
        if ($type =~ m/$function_pointer/) {
            # pointer-to-function
            print ".BI \"" . $parenth . $1 . "\" " . " \") (" . $2 . ")" . $post . "\"\n";
        } else {
            $type =~ s/([^\*])$/$1 /;
            print ".BI \"" . $parenth . $type . "\" " . " \"" . $post . "\"\n";
        }
        $count++;
        $parenth = "";
    }

    print ".SH ARGUMENTS\n";
    foreach $parameter (@{$args{'parameterlist'}}) {
        my $parameter_name = $parameter;
        $parameter_name =~ s/\[.*//;

        print ".IP \"" . $parameter . "\" 12\n";
        output_highlight($args{'parameterdescs'}{$parameter_name});
    }
    foreach $section (@{$args{'sectionlist'}}) {
        print ".SH \"", uc $section, "\"\n";
        output_highlight($args{'sections'}{$section});
    }
}

##
# output enum in man
sub output_enum_man(%) {
    my %args = %{$_[0]};
    my ($parameter, $section);
    my $count;

    print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" \"API Manual\" LINUX\n";

    print ".SH NAME\n";
    print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n";

    print ".SH SYNOPSIS\n";
    print "enum " . $args{'enum'} . " {\n";
    $count = 0;
    foreach my $parameter (@{$args{'parameterlist'}}) {
        print ".br\n.BI \"    $parameter\"\n";
        if ($count == $#{$args{'parameterlist'}}) {
            print "\n};\n";
            last;
        } else {
            print ", \n.br\n";
        }
        $count++;
    }

    print ".SH Constants\n";
    foreach $parameter (@{$args{'parameterlist'}}) {
        my $parameter_name = $parameter;
        $parameter_name =~ s/\[.*//;

        print ".IP \"" . $parameter . "\" 12\n";
        output_highlight($args{'parameterdescs'}{$parameter_name});
    }
    foreach $section (@{$args{'sectionlist'}}) {
        print ".SH \"$section\"\n";
        output_highlight($args{'sections'}{$section});
    }
}

##
# output struct in man
sub output_struct_man(%) {
    my %args = %{$_[0]};
    my ($parameter, $section);

    print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'struct'} . "\" \"$man_date\" \"API Manual\" LINUX\n";

    print ".SH NAME\n";
    print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose'} . "\n";

    my $declaration = $args{'definition'};
    $declaration =~ s/\t/  /g;
    $declaration =~ s/\n/"\n.br\n.BI \"/g;
    print ".SH SYNOPSIS\n";
    print $args{'type'} . " " . $args{'struct'} . " {\n.br\n";
    print ".BI \"$declaration\n};\n.br\n\n";

    print ".SH Members\n";
    foreach $parameter (@{$args{'parameterlist'}}) {
        ($parameter =~ /^#/) && next;

        my $parameter_name = $parameter;
        $parameter_name =~ s/\[.*//;

        ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
        print ".IP \"" . $parameter . "\" 12\n";
        output_highlight($args{'parameterdescs'}{$parameter_name});
    }
    foreach $section (@{$args{'sectionlist'}}) {
        print ".SH \"$section\"\n";
        output_highlight($args{'sections'}{$section});
    }
}

##
# output typedef in man
sub output_typedef_man(%) {
    my %args = %{$_[0]};
    my ($parameter, $section);

    print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"API Manual\" LINUX\n";

    print ".SH NAME\n";
    print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n";

    foreach $section (@{$args{'sectionlist'}}) {
        print ".SH \"$section\"\n";
        output_highlight($args{'sections'}{$section});
    }
}

sub output_blockhead_man(%) {
    my %args = %{$_[0]};
    my ($parameter, $section);
    my $count;

    print ".TH \"$args{'module'}\" 9 \"$args{'module'}\" \"$man_date\" \"API Manual\" LINUX\n";

    foreach $section (@{$args{'sectionlist'}}) {
        print ".SH \"$section\"\n";
        output_highlight($args{'sections'}{$section});
    }
}

##
# output in restructured text
#

#
# This could use some work; it's used to output the DOC: sections, and
# starts by putting out the name of the doc section itself, but that tends
# to duplicate a header already in the template file.
#
sub output_blockhead_rst(%) {
    my %args = %{$_[0]};
    my ($parameter, $section);

    foreach $section (@{$args{'sectionlist'}}) {
        next if (defined($nosymbol_table{$section}));

        if ($output_selection != OUTPUT_INCLUDE) {
            print ".. _$section:\n\n";
            print "**$section**\n\n";
        }
        print_lineno($section_start_lines{$section});
        output_highlight_rst($args{'sections'}{$section});
        print "\n";
    }
}

#
# Apply the RST highlights to a sub-block of text.
#
sub highlight_block($) {
    # The dohighlight kludge requires the text be called $contents
    my $contents = shift;
    eval $dohighlight;
    die $@ if $@;
    return $contents;
}

#
# Regexes used only here.
#
my $sphinx_literal = '^[^.].*::$';
my $sphinx_cblock = '^\.\.\ +code-block::';

sub output_highlight_rst {
    my $input = join "\n",@_;
    my $output = "";
    my $line;
    my $in_literal = 0;
    my $litprefix;
    my $block = "";

    foreach $line (split "\n",$input) {
        #
        # If we're in a literal block, see if we should drop out
        # of it.  Otherwise pass the line straight through unmunged.
        #
        if ($in_literal) {
            if (! ($line =~ /^\s*$/)) {
                #
                # If this is the first non-blank line in a literal
                # block we need to figure out what the proper indent is.
                #
                if ($litprefix eq "") {
                    $line =~ /^(\s*)/;
                    $litprefix = '^' . $1;
                    $output .= $line . "\n";
                } elsif (! ($line =~ /$litprefix/)) {
                    $in_literal = 0;
                } else {
                    $output .= $line . "\n";
                }
            } else {
                $output .= $line . "\n";
            }
        }
        #
        # Not in a literal block (or just dropped out)
        #
        if (! $in_literal) {
            $block .= $line . "\n";
            if (($line =~ /$sphinx_literal/) || ($line =~ /$sphinx_cblock/)) {
                $in_literal = 1;
                $litprefix = "";
                $output .= highlight_block($block);
                $block = ""
            }
        }
    }

    if ($block) {
        $output .= highlight_block($block);
    }
    foreach $line (split "\n", $output) {
        print $lineprefix . $line . "\n";
    }
}

sub output_function_rst(%) {
    my %args = %{$_[0]};
    my ($parameter, $section);
    my $oldprefix = $lineprefix;

    my $signature = "";
    if ($args{'functiontype'} ne "") {
        $signature = $args{'functiontype'} . " " . $args{'function'} . " (";
    } else {
        $signature = $args{'function'} . " (";
    }

    my $count = 0;
    foreach my $parameter (@{$args{'parameterlist'}}) {
        if ($count ne 0) {
            $signature .= ", ";
        }
        $count++;
        $type = $args{'parametertypes'}{$parameter};

        if ($type =~ m/$function_pointer/) {
            # pointer-to-function
            $signature .= $1 . $parameter . ") (" . $2 . ")";
        } else {
            $signature .= $type;
        }
    }

    $signature .= ")";

    if ($sphinx_major < 3) {
        if ($args{'typedef'}) {
            print ".. c:type:: ". $args{'function'} . "\n\n";
            print_lineno($declaration_start_line);
            print "   **Typedef**: ";
            $lineprefix = "";
            output_highlight_rst($args{'purpose'});
            print "\n\n**Syntax**\n\n";
            print "  ``$signature``\n\n";
        } else {
            print ".. c:function:: $signature\n\n";
        }
    } else {
        if ($args{'typedef'} || $args{'functiontype'} eq "") {
            print ".. c:macro:: ". $args{'function'} . "\n\n";

            if ($args{'typedef'}) {
                print_lineno($declaration_start_line);
                print "   **Typedef**: ";
                $lineprefix = "";
                output_highlight_rst($args{'purpose'});
                print "\n\n**Syntax**\n\n";
                print "  ``$signature``\n\n";
            } else {
                print "``$signature``\n\n";
            }
        } else {
            print ".. c:function:: $signature\n\n";
        }
    }

    if (!$args{'typedef'}) {
        print_lineno($declaration_start_line);
        $lineprefix = "   ";
        output_highlight_rst($args{'purpose'});
        print "\n";
    }

    #
    # Put our descriptive text into a container (thus an HTML <div>) to help
    # set the function prototypes apart.
    #
    print ".. container:: kernelindent\n\n";
    $lineprefix = "  ";
    print $lineprefix . "**Parameters**\n\n";
    foreach $parameter (@{$args{'parameterlist'}}) {
        my $parameter_name = $parameter;
        $parameter_name =~ s/\[.*//;
        $type = $args{'parametertypes'}{$parameter};

        if ($type ne "") {
            print $lineprefix . "``$type``\n";
        } else {
            print $lineprefix . "``$parameter``\n";
        }

        print_lineno($parameterdesc_start_lines{$parameter_name});

        $lineprefix = "    ";
        if (defined($args{'parameterdescs'}{$parameter_name}) &&
            $args{'parameterdescs'}{$parameter_name} ne $undescribed) {
            output_highlight_rst($args{'parameterdescs'}{$parameter_name});
        } else {
            print $lineprefix . "*undescribed*\n";
        }
        $lineprefix = "  ";
        print "\n";
    }

    output_section_rst(@_);
    $lineprefix = $oldprefix;
}

sub output_section_rst(%) {
    my %args = %{$_[0]};
    my $section;
    my $oldprefix = $lineprefix;

    foreach $section (@{$args{'sectionlist'}}) {
        print $lineprefix . "**$section**\n\n";
        print_lineno($section_start_lines{$section});
        output_highlight_rst($args{'sections'}{$section});
        print "\n";
    }
    print "\n";
}

sub output_enum_rst(%) {
    my %args = %{$_[0]};
    my ($parameter);
    my $oldprefix = $lineprefix;
    my $count;
    my $outer;

    if ($sphinx_major < 3) {
        my $name = "enum " . $args{'enum'};
        print "\n\n.. c:type:: " . $name . "\n\n";
    } else {
        my $name = $args{'enum'};
        print "\n\n.. c:enum:: " . $name . "\n\n";
    }
    print_lineno($declaration_start_line);
    $lineprefix = "  ";
    output_highlight_rst($args{'purpose'});
    print "\n";

    print ".. container:: kernelindent\n\n";
    $outer = $lineprefix . "  ";
    $lineprefix = $outer . "  ";
    print $outer . "**Constants**\n\n";
    foreach $parameter (@{$args{'parameterlist'}}) {
        print $outer . "``$parameter``\n";

        if ($args{'parameterdescs'}{$parameter} ne $undescribed) {
            output_highlight_rst($args{'parameterdescs'}{$parameter});
        } else {
            print $lineprefix . "*undescribed*\n";
        }
        print "\n";
    }
    print "\n";
    $lineprefix = $oldprefix;
    output_section_rst(@_);
}

sub output_typedef_rst(%) {
    my %args = %{$_[0]};
    my ($parameter);
    my $oldprefix = $lineprefix;
    my $name;

    if ($sphinx_major < 3) {
        $name = "typedef " . $args{'typedef'};
    } else {
        $name = $args{'typedef'};
    }
    print "\n\n.. c:type:: " . $name . "\n\n";
    print_lineno($declaration_start_line);
    $lineprefix = "   ";
    output_highlight_rst($args{'purpose'});
    print "\n";

    $lineprefix = $oldprefix;
    output_section_rst(@_);
}

sub output_struct_rst(%) {
    my %args = %{$_[0]};
    my ($parameter);
    my $oldprefix = $lineprefix;

    if ($sphinx_major < 3) {
        my $name = $args{'type'} . " " . $args{'struct'};
        print "\n\n.. c:type:: " . $name . "\n\n";
    } else {
        my $name = $args{'struct'};
        if ($args{'type'} eq 'union') {
            print "\n\n.. c:union:: " . $name . "\n\n";
        } else {
            print "\n\n.. c:struct:: " . $name . "\n\n";
        }
    }
    print_lineno($declaration_start_line);
    $lineprefix = "  ";
    output_highlight_rst($args{'purpose'});
    print "\n";

    print ".. container:: kernelindent\n\n";
    print $lineprefix . "**Definition**::\n\n";
    my $declaration = $args{'definition'};
    $lineprefix = $lineprefix . "  ";
    $declaration =~ s/\t/$lineprefix/g;
    print $lineprefix . $args{'type'} . " " . $args{'struct'} . " {\n$declaration" . $lineprefix . "};\n\n";

    $lineprefix = "  ";
    print $lineprefix . "**Members**\n\n";
    foreach $parameter (@{$args{'parameterlist'}}) {
        ($parameter =~ /^#/) && next;

        my $parameter_name = $parameter;
        $parameter_name =~ s/\[.*//;

        ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next;
        $type = $args{'parametertypes'}{$parameter};
        print_lineno($parameterdesc_start_lines{$parameter_name});
        print $lineprefix . "``" . $parameter . "``\n";
        $lineprefix = "    ";
        output_highlight_rst($args{'parameterdescs'}{$parameter_name});
        $lineprefix = "  ";
        print "\n";
    }
    print "\n";

    $lineprefix = $oldprefix;
    output_section_rst(@_);
}

## none mode output functions

sub output_function_none(%) {
}

sub output_enum_none(%) {
}

sub output_typedef_none(%) {
}

sub output_struct_none(%) {
}

sub output_blockhead_none(%) {
}

##
# generic output function for all types (function, struct/union, typedef, enum);
# calls the generated, variable output_ function name based on
# functype and output_mode
sub output_declaration {
    no strict 'refs';
    my $name = shift;
    my $functype = shift;
    my $func = "output_${functype}_$output_mode";

    return if (defined($nosymbol_table{$name}));

    if (($output_selection == OUTPUT_ALL) ||
        (($output_selection == OUTPUT_INCLUDE ||
          $output_selection == OUTPUT_EXPORTED) &&
         defined($function_table{$name})) ||
        ($output_selection == OUTPUT_INTERNAL &&
         !($functype eq "function" && defined($function_table{$name}))))
    {
        &$func(@_);
        $section_counter++;
    }
}

##
# generic output function - calls the right one based on current output mode.
sub output_blockhead {
    no strict 'refs';
    my $func = "output_blockhead_" . $output_mode;
    &$func(@_);
    $section_counter++;
}

##
# takes a declaration (struct, union, enum, typedef) and
# invokes the right handler. NOT called for functions.
sub dump_declaration($$) {
    no strict 'refs';
    my ($prototype, $file) = @_;
    my $func = "dump_" . $decl_type;
    &$func(@_);
}

sub dump_union($$) {
    dump_struct(@_);
}

sub dump_struct($$) {
    my $x = shift;
    my $file = shift;
    my $decl_type;
    my $members;
    my $type = qr{struct|union};
    # For capturing struct/union definition body, i.e. "{members*}qualifiers*"
    my $qualifiers = qr{$attribute|__packed|__aligned|____cacheline_aligned_in_smp|____cacheline_aligned};
    my $definition_body = qr{\{(.*)\}\s*$qualifiers*};
    my $struct_members = qr{($type)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;};

    if ($x =~ /($type)\s+(\w+)\s*$definition_body/) {
        $decl_type = $1;
        $declaration_name = $2;
        $members = $3;
    } elsif ($x =~ /typedef\s+($type)\s*$definition_body\s*(\w+)\s*;/) {
        $decl_type = $1;
        $declaration_name = $3;
        $members = $2;
    }

    if ($members) {
        if ($identifier ne $declaration_name) {
            emit_warning("${file}:$.", "expecting prototype for $decl_type $identifier. Prototype was for $decl_type $declaration_name instead\n");
            return;
        }

        # ignore members marked private:
        $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
        $members =~ s/\/\*\s*private:.*//gosi;
        # strip comments:
        $members =~ s/\/\*.*?\*\///gos;
        # strip attributes
        $members =~ s/\s*$attribute/ /gi;
        $members =~ s/\s*__aligned\s*\([^;]*\)/ /gos;
        $members =~ s/\s*__counted_by\s*\([^;]*\)/ /gos;
        $members =~ s/\s*__counted_by_(le|be)\s*\([^;]*\)/ /gos;
        $members =~ s/\s*__packed\s*/ /gos;
        $members =~ s/\s*CRYPTO_MINALIGN_ATTR/ /gos;
        $members =~ s/\s*____cacheline_aligned_in_smp/ /gos;
        $members =~ s/\s*____cacheline_aligned/ /gos;
        # unwrap struct_group():
        # - first eat non-declaration parameters and rewrite for final match
        # - then remove macro, outer parens, and trailing semicolon
        $members =~ s/\bstruct_group\s*\(([^,]*,)/STRUCT_GROUP(/gos;
        $members =~ s/\bstruct_group_attr\s*\(([^,]*,){2}/STRUCT_GROUP(/gos;
        $members =~ s/\bstruct_group_tagged\s*\(([^,]*),([^,]*),/struct $1 $2; STRUCT_GROUP(/gos;
        $members =~ s/\b__struct_group\s*\(([^,]*,){3}/STRUCT_GROUP(/gos;
        $members =~ s/\bSTRUCT_GROUP(\(((?:(?>[^)(]+)|(?1))*)\))[^;]*;/$2/gos;

        my $args = qr{([^,)]+)};
        # replace DECLARE_BITMAP
        $members =~ s/__ETHTOOL_DECLARE_LINK_MODE_MASK\s*\(([^\)]+)\)/DECLARE_BITMAP($1, __ETHTOOL_LINK_MODE_MASK_NBITS)/gos;
        $members =~ s/DECLARE_PHY_INTERFACE_MASK\s*\(([^\)]+)\)/DECLARE_BITMAP($1, PHY_INTERFACE_MODE_MAX)/gos;
        $members =~ s/DECLARE_BITMAP\s*\($args,\s*$args\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos;
        # replace DECLARE_HASHTABLE
        $members =~ s/DECLARE_HASHTABLE\s*\($args,\s*$args\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
        # replace DECLARE_KFIFO
        $members =~ s/DECLARE_KFIFO\s*\($args,\s*$args,\s*$args\)/$2 \*$1/gos;
        # replace DECLARE_KFIFO_PTR
        $members =~ s/DECLARE_KFIFO_PTR\s*\($args,\s*$args\)/$2 \*$1/gos;
        # replace DECLARE_FLEX_ARRAY
        $members =~ s/(?:__)?DECLARE_FLEX_ARRAY\s*\($args,\s*$args\)/$1 $2\[\]/gos;
        #replace DEFINE_DMA_UNMAP_ADDR
        $members =~ s/DEFINE_DMA_UNMAP_ADDR\s*\($args\)/dma_addr_t $1/gos;
        #replace DEFINE_DMA_UNMAP_LEN
        $members =~ s/DEFINE_DMA_UNMAP_LEN\s*\($args\)/__u32 $1/gos;
        my $declaration = $members;

        # Split nested struct/union elements as newer ones
        while ($members =~ m/$struct_members/) {
            my $newmember;
            my $maintype = $1;
            my $ids = $4;
            my $content = $3;
            foreach my $id(split /,/, $ids) {
                $newmember .= "$maintype $id; ";

                $id =~ s/[:\[].*//;
                $id =~ s/^\s*\**(\S+)\s*/$1/;
                foreach my $arg (split /;/, $content) {
                    next if ($arg =~ m/^\s*$/);
                    if ($arg =~ m/^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)/) {
                        # pointer-to-function
                        my $type = $1;
                        my $name = $2;
                        my $extra = $3;
                        next if (!$name);
                        if ($id =~ m/^\s*$/) {
                            # anonymous struct/union
                            $newmember .= "$type$name$extra; ";
                        } else {
                            $newmember .= "$type$id.$name$extra; ";
                        }
                    } else {
                        my $type;
                        my $names;
                        $arg =~ s/^\s+//;
                        $arg =~ s/\s+$//;
                        # Handle bitmaps
                        $arg =~ s/:\s*\d+\s*//g;
                        # Handle arrays
                        $arg =~ s/\[.*\]//g;
                        # The type may have multiple words,
                        # and multiple IDs can be defined, like:
                        #    const struct foo, *bar, foobar
                        # So, we remove spaces when parsing the
                        # names, in order to match just names
                        # and commas for the names
                        $arg =~ s/\s*,\s*/,/g;
                        if ($arg =~ m/(.*)\s+([\S+,]+)/) {
                            $type = $1;
                            $names = $2;
                        } else {
                            $newmember .= "$arg; ";
                            next;
                        }
                        foreach my $name (split /,/, $names) {
                            $name =~ s/^\s*\**(\S+)\s*/$1/;
                            next if (($name =~ m/^\s*$/));
                            if ($id =~ m/^\s*$/) {
                                # anonymous struct/union
                                $newmember .= "$type $name; ";
                            } else {
                                $newmember .= "$type $id.$name; ";
                            }
                        }
                    }
                }
            }
            $members =~ s/$struct_members/$newmember/;
        }

        # Ignore other nested elements, like enums
        $members =~ s/(\{[^\{\}]*\})//g;

        create_parameterlist($members, ';', $file, $declaration_name);
        check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);

        # Adjust declaration for better display
        $declaration =~ s/([\{;])/$1\n/g;
        $declaration =~ s/\}\s+;/};/g;
        # Better handle inlined enums
        do {} while ($declaration =~ s/(enum\s+\{[^\}]+),([^\n])/$1,\n$2/);

        my @def_args = split /\n/, $declaration;
        my $level = 1;
        $declaration = "";
        foreach my $clause (@def_args) {
            $clause =~ s/^\s+//;
            $clause =~ s/\s+$//;
            $clause =~ s/\s+/ /;
            next if (!$clause);
            $level-- if ($clause =~ m/(\})/ && $level > 1);
            if (!($clause =~ m/^\s*#/)) {
                $declaration .= "\t" x $level;
            }
            $declaration .= "\t" . $clause . "\n";
            $level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/));
        }
        output_declaration($declaration_name,
                   'struct',
                   {'struct' => $declaration_name,
                    'module' => $modulename,
                    'definition' => $declaration,
                    'parameterlist' => \@parameterlist,
                    'parameterdescs' => \%parameterdescs,
                    'parametertypes' => \%parametertypes,
                    'sectionlist' => \@sectionlist,
                    'sections' => \%sections,
                    'purpose' => $declaration_purpose,
                    'type' => $decl_type
                   });
    } else {
        print STDERR "${file}:$.: error: Cannot parse struct or union!\n";
        ++$errors;
    }
}


sub show_warnings($$) {
    my $functype = shift;
    my $name = shift;

    return 0 if (defined($nosymbol_table{$name}));

    return 1 if ($output_selection == OUTPUT_ALL);

    if ($output_selection == OUTPUT_EXPORTED) {
        if (defined($function_table{$name})) {
            return 1;
        } else {
            return 0;
        }
    }
    if ($output_selection == OUTPUT_INTERNAL) {
        if (!($functype eq "function" && defined($function_table{$name}))) {
            return 1;
        } else {
            return 0;
        }
    }
    if ($output_selection == OUTPUT_INCLUDE) {
        if (defined($function_table{$name})) {
            return 1;
        } else {
            return 0;
        }
    }
    die("Please add the new output type at show_warnings()");
}

sub dump_enum($$) {
    my $x = shift;
    my $file = shift;
    my $members;

    # ignore members marked private:
    $x =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
    $x =~ s/\/\*\s*private:.*}/}/gosi;

    $x =~ s@/\*.*?\*/@@gos;	# strip comments.
    # strip #define macros inside enums
    $x =~ s@#\s*((define|ifdef|if)\s+|endif)[^;]*;@@gos;

    if ($x =~ /typedef\s+enum\s*\{(.*)\}\s*(\w*)\s*;/) {
        $declaration_name = $2;
        $members = $1;
    } elsif ($x =~ /enum\s+(\w*)\s*\{(.*)\}/) {
        $declaration_name = $1;
        $members = $2;
    }

    if ($members) {
        if ($identifier ne $declaration_name) {
            if ($identifier eq "") {
                emit_warning("${file}:$.", "wrong kernel-doc identifier on line:\n");
            } else {
                emit_warning("${file}:$.", "expecting prototype for enum $identifier. Prototype was for enum $declaration_name instead\n");
            }
            return;
        }
        $declaration_name = "(anonymous)" if ($declaration_name eq "");

        my %_members;

        $members =~ s/\s+$//;
        $members =~ s/\([^;]*?[\)]//g;

        foreach my $arg (split ',', $members) {
            $arg =~ s/^\s*(\w+).*/$1/;
            push @parameterlist, $arg;
            if (!$parameterdescs{$arg}) {
                $parameterdescs{$arg} = $undescribed;
                if (show_warnings("enum", $declaration_name)) {
                    emit_warning("${file}:$.", "Enum value '$arg' not described in enum '$declaration_name'\n");
                }
            }
            $_members{$arg} = 1;
        }

        while (my ($k, $v) = each %parameterdescs) {
            if (!exists($_members{$k})) {
                if (show_warnings("enum", $declaration_name)) {
                    emit_warning("${file}:$.", "Excess enum value '$k' description in '$declaration_name'\n");
                }
            }
        }

        output_declaration($declaration_name,
                           'enum',
                           {'enum' => $declaration_name,
                            'module' => $modulename,
                            'parameterlist' => \@parameterlist,
                            'parameterdescs' => \%parameterdescs,
                            'sectionlist' => \@sectionlist,
                            'sections' => \%sections,
                            'purpose' => $declaration_purpose
                           });
    } else {
        print STDERR "${file}:$.: error: Cannot parse enum!\n";
        ++$errors;
    }
}

my $typedef_type = qr { ((?:\s+[\w\*]+\b){1,8})\s* }x;
my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
my $typedef_args = qr { \s*\((.*)\); }x;

my $typedef1 = qr { typedef$typedef_type\($typedef_ident\)$typedef_args }x;
my $typedef2 = qr { typedef$typedef_type$typedef_ident$typedef_args }x;

sub dump_typedef($$) {
    my $x = shift;
    my $file = shift;

    $x =~ s@/\*.*?\*/@@gos;	# strip comments.

    # Parse function typedef prototypes
    if ($x =~ $typedef1 || $x =~ $typedef2) {
        $return_type = $1;
        $declaration_name = $2;
        my $args = $3;
        $return_type =~ s/^\s+//;

        if ($identifier ne $declaration_name) {
            emit_warning("${file}:$.", "expecting prototype for typedef $identifier. Prototype was for typedef $declaration_name instead\n");
            return;
        }

        create_parameterlist($args, ',', $file, $declaration_name);

        output_declaration($declaration_name,
                           'function',
                           {'function' => $declaration_name,
                            'typedef' => 1,
                            'module' => $modulename,
                            'functiontype' => $return_type,
                            'parameterlist' => \@parameterlist,
                            'parameterdescs' => \%parameterdescs,
                            'parametertypes' => \%parametertypes,
                            'sectionlist' => \@sectionlist,
                            'sections' => \%sections,
                            'purpose' => $declaration_purpose
                           });
        return;
    }

    while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) {
        $x =~ s/\(*.\)\s*;$/;/;
        $x =~ s/\[*.\]\s*;$/;/;
    }

    if ($x =~ /typedef.*\s+(\w+)\s*;/) {
        $declaration_name = $1;

        if ($identifier ne $declaration_name) {
            emit_warning("${file}:$.", "expecting prototype for typedef $identifier. Prototype was for typedef $declaration_name instead\n");
            return;
        }

        output_declaration($declaration_name,
                           'typedef',
                           {'typedef' => $declaration_name,
                            'module' => $modulename,
                            'sectionlist' => \@sectionlist,
                            'sections' => \%sections,
                            'purpose' => $declaration_purpose
                           });
    } else {
        print STDERR "${file}:$.: error: Cannot parse typedef!\n";
        ++$errors;
    }
}

sub save_struct_actual($) {
    my $actual = shift;

    # strip all spaces from the actual param so that it looks like one string item
    $actual =~ s/\s*//g;
    $struct_actual = $struct_actual . $actual . " ";
}

sub create_parameterlist($$$$) {
    my $args = shift;
    my $splitter = shift;
    my $file = shift;
    my $declaration_name = shift;
    my $type;
    my $param;

    # temporarily replace commas inside function pointer definition
    my $arg_expr = qr{\([^\),]+};
    while ($args =~ /$arg_expr,/) {
        $args =~ s/($arg_expr),/$1#/g;
    }

    foreach my $arg (split($splitter, $args)) {
        # strip comments
        $arg =~ s/\/\*.*\*\///;
        # ignore argument attributes
        $arg =~ s/\sPOS0?\s/ /;
        # strip leading/trailing spaces
        $arg =~ s/^\s*//;
        $arg =~ s/\s*$//;
        $arg =~ s/\s+/ /;

        if ($arg =~ /^#/) {
            # Treat preprocessor directive as a typeless variable just to fill
            # corresponding data structures "correctly". Catch it later in
            # output_* subs.
            push_parameter($arg, "", "", $file);
        } elsif ($arg =~ m/\(.+\)\s*\(/) {
            # pointer-to-function
            $arg =~ tr/#/,/;
            $arg =~ m/[^\(]+\(\*?\s*([\w\[\]\.]*)\s*\)/;
            $param = $1;
            $type = $arg;
            $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
            save_struct_actual($param);
            push_parameter($param, $type, $arg, $file, $declaration_name);
        } elsif ($arg =~ m/\(.+\)\s*\[/) {
            # array-of-pointers
            $arg =~ tr/#/,/;
            $arg =~ m/[^\(]+\(\s*\*\s*([\w\[\]\.]*?)\s*(\s*\[\s*[\w]+\s*\]\s*)*\)/;
            $param = $1;
            $type = $arg;
            $type =~ s/([^\(]+\(\*?)\s*$param/$1/;
            save_struct_actual($param);
            push_parameter($param, $type, $arg, $file, $declaration_name);
        } elsif ($arg) {
            $arg =~ s/\s*:\s*/:/g;
            $arg =~ s/\s*\[/\[/g;

            my @args = split('\s*,\s*', $arg);
            if ($args[0] =~ m/\*/) {
                $args[0] =~ s/(\*+)\s*/ $1/;
            }

            my @first_arg;
            if ($args[0] =~ /^(.*\s+)(.*?\[.*\].*)$/) {
                shift @args;
                push(@first_arg, split('\s+', $1));
                push(@first_arg, $2);
            } else {
                @first_arg = split('\s+', shift @args);
            }

            unshift(@args, pop @first_arg);
            $type = join " ", @first_arg;

            foreach $param (@args) {
                if ($param =~ m/^(\*+)\s*(.*)/) {
                    save_struct_actual($2);

                    push_parameter($2, "$type $1", $arg, $file, $declaration_name);
                } elsif ($param =~ m/(.*?):(\w+)/) {
                    if ($type ne "") { # skip unnamed bit-fields
                        save_struct_actual($1);
                        push_parameter($1, "$type:$2", $arg, $file, $declaration_name)
                    }
                } else {
                    save_struct_actual($param);
                    push_parameter($param, $type, $arg, $file, $declaration_name);
                }
            }
        }
    }
}

sub push_parameter($$$$$) {
    my $param = shift;
    my $type = shift;
    my $org_arg = shift;
    my $file = shift;
    my $declaration_name = shift;

    if (($anon_struct_union == 1) && ($type eq "") &&
        ($param eq "}")) {
        return;        # ignore the ending }; from anon. struct/union
    }

    $anon_struct_union = 0;
    $param =~ s/[\[\)].*//;

    if ($type eq "" && $param =~ /\.\.\.$/)
    {
        if (!$param =~ /\w\.\.\.$/) {
            # handles unnamed variable parameters
            $param = "...";
        } elsif ($param =~ /\w\.\.\.$/) {
            # for named variable parameters of the form `x...`, remove the dots
            $param =~ s/\.\.\.$//;
        }
        if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") {
            $parameterdescs{$param} = "variable arguments";
        }
    }
    elsif ($type eq "" && ($param eq "" or $param eq "void"))
    {
        $param="void";
        $parameterdescs{void} = "no arguments";
    }
    elsif ($type eq "" && ($param eq "struct" or $param eq "union"))
    # handle unnamed (anonymous) union or struct:
    {
        $type = $param;
        $param = "{unnamed_" . $param . "}";
        $parameterdescs{$param} = "anonymous\n";
        $anon_struct_union = 1;
    }
    elsif ($param =~ "__cacheline_group" )
    # handle cache group enforcing variables: they do not need be described in header files
    {
        return; # ignore __cacheline_group_begin and __cacheline_group_end
    }

    # warn if parameter has no description
    # (but ignore ones starting with # as these are not parameters
    # but inline preprocessor statements);
    # Note: It will also ignore void params and unnamed structs/unions
    if (!defined $parameterdescs{$param} && $param !~ /^#/) {
        $parameterdescs{$param} = $undescribed;

        if (show_warnings($type, $declaration_name) && $param !~ /\./) {
            emit_warning("${file}:$.", "Function parameter or struct member '$param' not described in '$declaration_name'\n");
        }
    }

    # strip spaces from $param so that it is one continuous string
    # on @parameterlist;
    # this fixes a problem where check_sections() cannot find
    # a parameter like "addr[6 + 2]" because it actually appears
    # as "addr[6", "+", "2]" on the parameter list;
    # but it's better to maintain the param string unchanged for output,
    # so just weaken the string compare in check_sections() to ignore
    # "[blah" in a parameter string;
    ###$param =~ s/\s*//g;
    push @parameterlist, $param;
    $org_arg =~ s/\s\s+/ /g;
    $parametertypes{$param} = $org_arg;
}

sub check_sections($$$$$) {
    my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) = @_;
    my @sects = split ' ', $sectcheck;
    my @prms = split ' ', $prmscheck;
    my $err;
    my ($px, $sx);
    my $prm_clean;        # strip trailing "[array size]" and/or beginning "*"

    foreach $sx (0 .. $#sects) {
        $err = 1;
        foreach $px (0 .. $#prms) {
            $prm_clean = $prms[$px];
            $prm_clean =~ s/\[.*\]//;
            $prm_clean =~ s/$attribute//i;
            # ignore array size in a parameter string;
            # however, the original param string may contain
            # spaces, e.g.:  addr[6 + 2]
            # and this appears in @prms as "addr[6" since the
            # parameter list is split at spaces;
            # hence just ignore "[..." for the sections check;
            $prm_clean =~ s/\[.*//;

            ##$prm_clean =~ s/^\**//;
            if ($prm_clean eq $sects[$sx]) {
                $err = 0;
                last;
            }
        }
        if ($err) {
            if ($decl_type eq "function") {
                emit_warning("${file}:$.",
                    "Excess function parameter " .
                    "'$sects[$sx]' " .
                    "description in '$decl_name'\n");
            } elsif (($decl_type eq "struct") or
                          ($decl_type eq "union")) {
                emit_warning("${file}:$.",
                    "Excess $decl_type member " .
                    "'$sects[$sx]' " .
                    "description in '$decl_name'\n");
            }
        }
    }
}

##
# Checks the section describing the return value of a function.
sub check_return_section {
    my $file = shift;
    my $declaration_name = shift;
    my $return_type = shift;

    # Ignore an empty return type (It's a macro)
    # Ignore functions with a "void" return type. (But don't ignore "void *")
    if (($return_type eq "") || ($return_type =~ /void\s*\w*\s*$/)) {
        return;
    }

    if (!defined($sections{$section_return}) ||
        $sections{$section_return} eq "")
    {
        emit_warning("${file}:$.",
                     "No description found for return value of " .
                     "'$declaration_name'\n");
    }
}

##
# takes a function prototype and the name of the current file being
# processed and spits out all the details stored in the global
# arrays/hashes.
sub dump_function($$) {
    my $prototype = shift;
    my $file = shift;
    my $noret = 0;

    print_lineno($new_start_line);

    $prototype =~ s/^static +//;
    $prototype =~ s/^extern +//;
    $prototype =~ s/^asmlinkage +//;
    $prototype =~ s/^inline +//;
    $prototype =~ s/^__inline__ +//;
    $prototype =~ s/^__inline +//;
    $prototype =~ s/^__always_inline +//;
    $prototype =~ s/^noinline +//;
    $prototype =~ s/^__FORTIFY_INLINE +//;
    $prototype =~ s/__init +//;
    $prototype =~ s/__init_or_module +//;
    $prototype =~ s/__deprecated +//;
    $prototype =~ s/__flatten +//;
    $prototype =~ s/__meminit +//;
    $prototype =~ s/__must_check +//;
    $prototype =~ s/__weak +//;
    $prototype =~ s/__sched +//;
    $prototype =~ s/_noprof//;
    $prototype =~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//;
    $prototype =~ s/__(?:re)?alloc_size\s*\(\s*\d+\s*(?:,\s*\d+\s*)?\) +//;
    $prototype =~ s/__diagnose_as\s*\(\s*\S+\s*(?:,\s*\d+\s*)*\) +//;
    $prototype =~ s/DECL_BUCKET_PARAMS\s*\(\s*(\S+)\s*,\s*(\S+)\s*\)/$1, $2/;
    my $define = $prototype =~ s/^#\s*define\s+//; #ak added
    $prototype =~ s/__attribute_const__ +//;
    $prototype =~ s/__attribute__\s*\(\(
            (?:
                 [\w\s]++          # attribute name
                 (?:\([^)]*+\))?   # attribute arguments
                 \s*+,?            # optional comma at the end
            )+
          \)\)\s+//x;

    # Yes, this truly is vile.  We are looking for:
    # 1. Return type (may be nothing if we're looking at a macro)
    # 2. Function name
    # 3. Function parameters.
    #
    # All the while we have to watch out for function pointer parameters
    # (which IIRC is what the two sections are for), C types (these
    # regexps don't even start to express all the possibilities), and
    # so on.
    #
    # If you mess with these regexps, it's a good idea to check that
    # the following functions' documentation still comes out right:
    # - parport_register_device (function pointer parameters)
    # - atomic_set (macro)
    # - pci_match_device, __copy_to_user (long return type)
    my $name = qr{[a-zA-Z0-9_~:]+};
    my $prototype_end1 = qr{[^\(]*};
    my $prototype_end2 = qr{[^\{]*};
    my $prototype_end = qr{\(($prototype_end1|$prototype_end2)\)};
    my $type1 = qr{[\w\s]+};
    my $type2 = qr{$type1\*+};

    if ($define && $prototype =~ m/^()($name)\s+/) {
        # This is an object-like macro, it has no return type and no parameter
        # list.
        # Function-like macros are not allowed to have spaces between
        # declaration_name and opening parenthesis (notice the \s+).
        $return_type = $1;
        $declaration_name = $2;
        $noret = 1;
    } elsif ($prototype =~ m/^()($name)\s*$prototype_end/ ||
        $prototype =~ m/^($type1)\s+($name)\s*$prototype_end/ ||
        $prototype =~ m/^($type2+)\s*($name)\s*$prototype_end/)  {
        $return_type = $1;
        $declaration_name = $2;
        my $args = $3;

        create_parameterlist($args, ',', $file, $declaration_name);
    } else {
        emit_warning("${file}:$.", "cannot understand function prototype: '$prototype'\n");
        return;
    }

    if ($identifier ne $declaration_name) {
        emit_warning("${file}:$.", "expecting prototype for $identifier(). Prototype was for $declaration_name() instead\n");
        return;
    }

    my $prms = join " ", @parameterlist;
    check_sections($file, $declaration_name, "function", $sectcheck, $prms);

    # This check emits a lot of warnings at the moment, because many
    # functions don't have a 'Return' doc section. So until the number
    # of warnings goes sufficiently down, the check is only performed in
    # -Wreturn mode.
    # TODO: always perform the check.
    if ($Wreturn && !$noret) {
        check_return_section($file, $declaration_name, $return_type);
    }

    # The function parser can be called with a typedef parameter.
    # Handle it.
    if ($return_type =~ /typedef/) {
        output_declaration($declaration_name,
                           'function',
                           {'function' => $declaration_name,
                            'typedef' => 1,
                            'module' => $modulename,
                            'functiontype' => $return_type,
                            'parameterlist' => \@parameterlist,
                            'parameterdescs' => \%parameterdescs,
                            'parametertypes' => \%parametertypes,
                            'sectionlist' => \@sectionlist,
                            'sections' => \%sections,
                            'purpose' => $declaration_purpose
                           });
    } else {
        output_declaration($declaration_name,
                           'function',
                           {'function' => $declaration_name,
                            'module' => $modulename,
                            'functiontype' => $return_type,
                            'parameterlist' => \@parameterlist,
                            'parameterdescs' => \%parameterdescs,
                            'parametertypes' => \%parametertypes,
                            'sectionlist' => \@sectionlist,
                            'sections' => \%sections,
                            'purpose' => $declaration_purpose
                           });
    }
}

sub reset_state {
    $function = "";
    %parameterdescs = ();
    %parametertypes = ();
    @parameterlist = ();
    %sections = ();
    @sectionlist = ();
    $sectcheck = "";
    $struct_actual = "";
    $prototype = "";

    $state = STATE_NORMAL;
    $inline_doc_state = STATE_INLINE_NA;
}

sub tracepoint_munge($) {
    my $file = shift;
    my $tracepointname = 0;
    my $tracepointargs = 0;

    if ($prototype =~ m/TRACE_EVENT\((.*?),/) {
        $tracepointname = $1;
    }
    if ($prototype =~ m/DEFINE_SINGLE_EVENT\((.*?),/) {
        $tracepointname = $1;
    }
    if ($prototype =~ m/DEFINE_EVENT\((.*?),(.*?),/) {
        $tracepointname = $2;
    }
    $tracepointname =~ s/^\s+//; #strip leading whitespace
    if ($prototype =~ m/TP_PROTO\((.*?)\)/) {
        $tracepointargs = $1;
    }
    if (($tracepointname eq 0) || ($tracepointargs eq 0)) {
        emit_warning("${file}:$.", "Unrecognized tracepoint format: \n".
                 "$prototype\n");
    } else {
        $prototype = "static inline void trace_$tracepointname($tracepointargs)";
        $identifier = "trace_$identifier";
    }
}

sub syscall_munge() {
    my $void = 0;

    $prototype =~ s@[\r\n]+@ @gos; # strip newlines/CR's
##    if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
    if ($prototype =~ m/SYSCALL_DEFINE0/) {
        $void = 1;
##        $prototype = "long sys_$1(void)";
    }

    $prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name
    if ($prototype =~ m/long (sys_.*?),/) {
        $prototype =~ s/,/\(/;
    } elsif ($void) {
        $prototype =~ s/\)/\(void\)/;
    }

    # now delete all of the odd-number commas in $prototype
    # so that arg types & arg names don't have a comma between them
    my $count = 0;
    my $len = length($prototype);
    if ($void) {
        $len = 0;    # skip the for-loop
    }
    for (my $ix = 0; $ix < $len; $ix++) {
        if (substr($prototype, $ix, 1) eq ',') {
            $count++;
            if ($count % 2 == 1) {
                substr($prototype, $ix, 1) = ' ';
            }
        }
    }
}

sub process_proto_function($$) {
    my $x = shift;
    my $file = shift;

    $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line

    if ($x =~ /^#/ && $x !~ /^#\s*define/) {
        # do nothing
    } elsif ($x =~ /([^\{]*)/) {
        $prototype .= $1;
    }

    if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) {
        $prototype =~ s@/\*.*?\*/@@gos;        # strip comments.
        $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
        $prototype =~ s@^\s+@@gos; # strip leading spaces

        # Handle prototypes for function pointers like:
        # int (*pcs_config)(struct foo)
        $prototype =~ s@^(\S+\s+)\(\s*\*(\S+)\)@$1$2@gos;

        if ($prototype =~ /SYSCALL_DEFINE/) {
            syscall_munge();
        }
        if ($prototype =~ /TRACE_EVENT/ || $prototype =~ /DEFINE_EVENT/ ||
            $prototype =~ /DEFINE_SINGLE_EVENT/)
        {
            tracepoint_munge($file);
        }
        dump_function($prototype, $file);
        reset_state();
    }
}

sub process_proto_type($$) {
    my $x = shift;
    my $file = shift;

    $x =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
    $x =~ s@^\s+@@gos; # strip leading spaces
    $x =~ s@\s+$@@gos; # strip trailing spaces
    $x =~ s@\/\/.*$@@gos; # strip C99-style comments to end of line

    if ($x =~ /^#/) {
        # To distinguish preprocessor directive from regular declaration later.
        $x .= ";";
    }

    while (1) {
        if ( $x =~ /([^\{\};]*)([\{\};])(.*)/ ) {
            if( length $prototype ) {
                $prototype .= " "
            }
            $prototype .= $1 . $2;
            ($2 eq '{') && $brcount++;
            ($2 eq '}') && $brcount--;
            if (($2 eq ';') && ($brcount == 0)) {
                dump_declaration($prototype, $file);
                reset_state();
                last;
            }
            $x = $3;
        } else {
            $prototype .= $x;
            last;
        }
    }
}


sub map_filename($) {
    my $file;
    my ($orig_file) = @_;

    if (defined($ENV{'SRCTREE'})) {
        $file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
    } else {
        $file = $orig_file;
    }

    if (defined($source_map{$file})) {
        $file = $source_map{$file};
    }

    return $file;
}

sub process_export_file($) {
    my ($orig_file) = @_;
    my $file = map_filename($orig_file);

    if (!open(IN,"<$file")) {
        print STDERR "Error: Cannot open file $file\n";
        ++$errors;
        return;
    }

    while (<IN>) {
        if (/$export_symbol/) {
            next if (defined($nosymbol_table{$2}));
            $function_table{$2} = 1;
        }
        if (/$export_symbol_ns/) {
            next if (defined($nosymbol_table{$2}));
            $function_table{$2} = 1;
        }
    }

    close(IN);
}

#
# Parsers for the various processing states.
#
# STATE_NORMAL: looking for the /** to begin everything.
#
sub process_normal() {
    if (/$doc_start/o) {
        $state = STATE_NAME;        # next line is always the function name
        $in_doc_sect = 0;
        $declaration_start_line = $. + 1;
    }
}

#
# STATE_NAME: Looking for the "name - description" line
#
sub process_name($$) {
    my $file = shift;
    my $descr;

    if (/$doc_block/o) {
        $state = STATE_DOCBLOCK;
        $contents = "";
        $new_start_line = $.;

        if ( $1 eq "" ) {
            $section = $section_intro;
        } else {
            $section = $1;
        }
    } elsif (/$doc_decl/o) {
        $identifier = $1;
        my $is_kernel_comment = 0;
        my $decl_start = qr{$doc_com};
        # test for pointer declaration type, foo * bar() - desc
        my $fn_type = qr{\w+\s*\*\s*};
        my $parenthesis = qr{\(\w*\)};
        my $decl_end = qr{[-:].*};
        if (/^$decl_start([\w\s]+?)$parenthesis?\s*$decl_end?$/) {
            $identifier = $1;
        }
        if ($identifier =~ m/^(struct|union|enum|typedef)\b\s*(\S*)/) {
            $decl_type = $1;
            $identifier = $2;
            $is_kernel_comment = 1;
        }
        # Look for foo() or static void foo() - description; or misspelt
        # identifier
        elsif (/^$decl_start$fn_type?(\w+)\s*$parenthesis?\s*$decl_end?$/ ||
            /^$decl_start$fn_type?(\w+.*)$parenthesis?\s*$decl_end$/) {
            $identifier = $1;
            $decl_type = 'function';
            $identifier =~ s/^define\s+//;
            $is_kernel_comment = 1;
        }
        $identifier =~ s/\s+$//;

        $state = STATE_BODY;
        # if there's no @param blocks need to set up default section
        # here
        $contents = "";
        $section = $section_default;
        $new_start_line = $. + 1;
        if (/[-:](.*)/) {
            # strip leading/trailing/multiple spaces
            $descr= $1;
            $descr =~ s/^\s*//;
            $descr =~ s/\s*$//;
            $descr =~ s/\s+/ /g;
            $declaration_purpose = $descr;
            $state = STATE_BODY_MAYBE;
        } else {
            $declaration_purpose = "";
        }

        if (!$is_kernel_comment) {
            emit_warning("${file}:$.", "This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst\n$_");
            $state = STATE_NORMAL;
        }

        if (($declaration_purpose eq "") && $Wshort_desc) {
            emit_warning("${file}:$.", "missing initial short description on line:\n$_");
        }

        if ($identifier eq "" && $decl_type ne "enum") {
            emit_warning("${file}:$.", "wrong kernel-doc identifier on line:\n$_");
            $state = STATE_NORMAL;
        }

        if ($verbose) {
            print STDERR "${file}:$.: info: Scanning doc for $decl_type $identifier\n";
        }
    } else {
        emit_warning("${file}:$.", "Cannot understand $_ on line $. - I thought it was a doc line\n");
        $state = STATE_NORMAL;
    }
}


#
# STATE_BODY and STATE_BODY_MAYBE: the bulk of a kerneldoc comment.
#
sub process_body($$) {
    my $file = shift;

    if ($state == STATE_BODY_WITH_BLANK_LINE && /^\s*\*\s?\S/) {
        dump_section($file, $section, $contents);
        $section = $section_default;
        $new_start_line = $.;
        $contents = "";
    }

    if (/$doc_sect/i) { # case insensitive for supported section names
        $in_doc_sect = 1;
        $newsection = $1;
        $newcontents = $2;

        # map the supported section names to the canonical names
        if ($newsection =~ m/^description$/i) {
            $newsection = $section_default;
        } elsif ($newsection =~ m/^context$/i) {
            $newsection = $section_context;
        } elsif ($newsection =~ m/^returns?$/i) {
            $newsection = $section_return;
        } elsif ($newsection =~ m/^\@return$/) {
            # special: @return is a section, not a param description
            $newsection = $section_return;
        }

        if (($contents ne "") && ($contents ne "\n")) {
            if (!$in_doc_sect && $Wcontents_before_sections) {
                emit_warning("${file}:$.", "contents before sections\n");
            }
            dump_section($file, $section, $contents);
            $section = $section_default;
        }

        $in_doc_sect = 1;
        $state = STATE_BODY;
        $contents = $newcontents;
        $new_start_line = $.;
        while (substr($contents, 0, 1) eq " ") {
            $contents = substr($contents, 1);
        }
        if ($contents ne "") {
            $contents .= "\n";
        }
        $section = $newsection;
        $leading_space = undef;
    } elsif (/$doc_end/) {
        if (($contents ne "") && ($contents ne "\n")) {
            dump_section($file, $section, $contents);
            $section = $section_default;
            $contents = "";
        }
        # look for doc_com + <text> + doc_end:
        if ($_ =~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') {
            emit_warning("${file}:$.", "suspicious ending line: $_");
        }

        $prototype = "";
        $state = STATE_PROTO;
        $brcount = 0;
        $new_start_line = $. + 1;
    } elsif (/$doc_content/) {
        if ($1 eq "") {
            if ($section eq $section_context) {
                dump_section($file, $section, $contents);
                $section = $section_default;
                $contents = "";
                $new_start_line = $.;
                $state = STATE_BODY;
            } else {
                if ($section ne $section_default) {
                    $state = STATE_BODY_WITH_BLANK_LINE;
                } else {
                    $state = STATE_BODY;
                }
                $contents .= "\n";
            }
        } elsif ($state == STATE_BODY_MAYBE) {
            # Continued declaration purpose
            chomp($declaration_purpose);
            $declaration_purpose .= " " . $1;
            $declaration_purpose =~ s/\s+/ /g;
        } else {
            my $cont = $1;
            if ($section =~ m/^@/ || $section eq $section_context) {
                if (!defined $leading_space) {
                    if ($cont =~ m/^(\s+)/) {
                        $leading_space = $1;
                    } else {
                        $leading_space = "";
                    }
                }
                $cont =~ s/^$leading_space//;
            }
            $contents .= $cont . "\n";
        }
    } else {
        # i dont know - bad line?  ignore.
        emit_warning("${file}:$.", "bad line: $_");
    }
}


#
# STATE_PROTO: reading a function/whatever prototype.
#
sub process_proto($$) {
    my $file = shift;

    if (/$doc_inline_oneline/) {
        $section = $1;
        $contents = $2;
        if ($contents ne "") {
            $contents .= "\n";
            dump_section($file, $section, $contents);
            $section = $section_default;
            $contents = "";
        }
    } elsif (/$doc_inline_start/) {
        $state = STATE_INLINE;
        $inline_doc_state = STATE_INLINE_NAME;
    } elsif ($decl_type eq 'function') {
        process_proto_function($_, $file);
    } else {
        process_proto_type($_, $file);
    }
}

#
# STATE_DOCBLOCK: within a DOC: block.
#
sub process_docblock($$) {
    my $file = shift;

    if (/$doc_end/) {
        dump_doc_section($file, $section, $contents);
        $section = $section_default;
        $contents = "";
        $function = "";
        %parameterdescs = ();
        %parametertypes = ();
        @parameterlist = ();
        %sections = ();
        @sectionlist = ();
        $prototype = "";
        $state = STATE_NORMAL;
    } elsif (/$doc_content/) {
        if ( $1 eq "" )        {
            $contents .= $blankline;
        } else {
            $contents .= $1 . "\n";
        }
    }
}

#
# STATE_INLINE: docbook comments within a prototype.
#
sub process_inline($$) {
    my $file = shift;

    # First line (state 1) needs to be a @parameter
    if ($inline_doc_state == STATE_INLINE_NAME && /$doc_inline_sect/o) {
        $section = $1;
        $contents = $2;
        $new_start_line = $.;
        if ($contents ne "") {
            while (substr($contents, 0, 1) eq " ") {
                $contents = substr($contents, 1);
            }
            $contents .= "\n";
        }
        $inline_doc_state = STATE_INLINE_TEXT;
        # Documentation block end */
    } elsif (/$doc_inline_end/) {
        if (($contents ne "") && ($contents ne "\n")) {
            dump_section($file, $section, $contents);
            $section = $section_default;
            $contents = "";
        }
        $state = STATE_PROTO;
        $inline_doc_state = STATE_INLINE_NA;
        # Regular text
    } elsif (/$doc_content/) {
        if ($inline_doc_state == STATE_INLINE_TEXT) {
            $contents .= $1 . "\n";
            # nuke leading blank lines
            if ($contents =~ /^\s*$/) {
                $contents = "";
            }
        } elsif ($inline_doc_state == STATE_INLINE_NAME) {
            $inline_doc_state = STATE_INLINE_ERROR;
            emit_warning("${file}:$.", "Incorrect use of kernel-doc format: $_");
        }
    }
}


sub process_file($) {
    my $file;
    my $initial_section_counter = $section_counter;
    my ($orig_file) = @_;

    $file = map_filename($orig_file);

    if (!open(IN_FILE,"<$file")) {
        print STDERR "Error: Cannot open file $file\n";
        ++$errors;
        return;
    }

    $. = 1;

    $section_counter = 0;
    while (<IN_FILE>) {
        while (!/^ \*/ && s/\\\s*$//) {
            $_ .= <IN_FILE>;
        }
        # Replace tabs by spaces
        while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
        # Hand this line to the appropriate state handler
        if ($state == STATE_NORMAL) {
            process_normal();
        } elsif ($state == STATE_NAME) {
            process_name($file, $_);
        } elsif ($state == STATE_BODY || $state == STATE_BODY_MAYBE ||
                 $state == STATE_BODY_WITH_BLANK_LINE) {
            process_body($file, $_);
        } elsif ($state == STATE_INLINE) { # scanning for inline parameters
            process_inline($file, $_);
        } elsif ($state == STATE_PROTO) {
            process_proto($file, $_);
        } elsif ($state == STATE_DOCBLOCK) {
            process_docblock($file, $_);
        }
    }

    # Make sure we got something interesting.
    if ($initial_section_counter == $section_counter && $
        output_mode ne "none") {
        if ($output_selection == OUTPUT_INCLUDE) {
            emit_warning("${file}:1", "'$_' not found\n")
                for keys %function_table;
        } else {
            emit_warning("${file}:1", "no structured comments found\n");
        }
    }
    close IN_FILE;
}


if ($output_mode eq "rst") {
    get_sphinx_version() if (!$sphinx_major);
}

$kernelversion = get_kernel_version();

# generate a sequence of code that will splice in highlighting information
# using the s// operator.
for (my $k = 0; $k < @highlights; $k++) {
    my $pattern = $highlights[$k][0];
    my $result = $highlights[$k][1];
#   print STDERR "scanning pattern:$pattern, highlight:($result)\n";
    $dohighlight .=  "\$contents =~ s:$pattern:$result:gs;\n";
}

# Read the file that maps relative names to absolute names for
# separate source and object directories and for shadow trees.
if (open(SOURCE_MAP, "<.tmp_filelist.txt")) {
    my ($relname, $absname);
    while(<SOURCE_MAP>) {
        chop();
        ($relname, $absname) = (split())[0..1];
        $relname =~ s:^/+::;
        $source_map{$relname} = $absname;
    }
    close(SOURCE_MAP);
}

if ($output_selection == OUTPUT_EXPORTED ||
    $output_selection == OUTPUT_INTERNAL) {

    push(@export_file_list, @ARGV);

    foreach (@export_file_list) {
        chomp;
        process_export_file($_);
    }
}

foreach (@ARGV) {
    chomp;
    process_file($_);
}
if ($verbose && $errors) {
    print STDERR "$errors errors\n";
}
if ($verbose && $warnings) {
    print STDERR "$warnings warnings\n";
}

if ($Werror && $warnings) {
    print STDERR "$warnings warnings as Errors\n";
    exit($warnings);
} else {
    exit($output_mode eq "none" ? 0 : $errors)
}

__END__

=head1 OPTIONS

=head2 Output format selection (mutually exclusive):

=over 8

=item -man

Output troff manual page format.

=item -rst

Output reStructuredText format. This is the default.

=item -none

Do not output documentation, only warnings.

=back

=head2 Output format modifiers

=head3 reStructuredText only

=over 8

=item -sphinx-version VERSION

Use the ReST C domain dialect compatible with a specific Sphinx Version.

If not specified, kernel-doc will auto-detect using the sphinx-build version
found on PATH.

=back

=head2 Output selection (mutually exclusive):

=over 8

=item -export

Only output documentation for the symbols that have been exported using
EXPORT_SYMBOL() and related macros in any input FILE or -export-file FILE.

=item -internal

Only output documentation for the symbols that have NOT been exported using
EXPORT_SYMBOL() and related macros in any input FILE or -export-file FILE.

=item -function NAME

Only output documentation for the given function or DOC: section title.
All other functions and DOC: sections are ignored.

May be specified multiple times.

=item -nosymbol NAME

Exclude the specified symbol from the output documentation.

May be specified multiple times.

=back

=head2 Output selection modifiers:

=over 8

=item -no-doc-sections

Do not output DOC: sections.

=item -export-file FILE

Specify an additional FILE in which to look for EXPORT_SYMBOL information.

To be used with -export or -internal.

May be specified multiple times.

=back

=head3 reStructuredText only

=over 8

=item -enable-lineno

Enable output of .. LINENO lines.

=back

=head2 Other parameters:

=over 8

=item -h, -help

Print this help.

=item -v

Verbose output, more warnings and other information.

=item -Werror

Treat warnings as errors.

=back

=cut
