#!/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*__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/__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*)*\) +//;
    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
