aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2018-02-05 17:46:30 -0500
committerJonathan Corbet <corbet@lwn.net>2018-02-15 15:11:24 -0500
commitcc794812eba917f271c6a09ac4cb1750497e404c (patch)
treeca0358324671bb46ba6b47ed8ddace41a0abc787 /scripts/kernel-doc
parentd742f24d6cce67656d93a704563c1594877a4ea0 (diff)
docs: kernel-doc: Move STATE_PROTO processing into its own function
Move the top-level prototype-processing code out of process_file(). Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc46
1 files changed, 28 insertions, 18 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a6a7bb46ea29..2deddb876156 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1965,6 +1965,32 @@ sub process_body($$) {
1965} 1965}
1966 1966
1967 1967
1968#
1969# STATE_PROTO: reading a function/whatever prototype.
1970#
1971sub process_proto($$) {
1972 my $file = shift;
1973
1974 if (/$doc_inline_oneline/) {
1975 $section = $1;
1976 $contents = $2;
1977 if ($contents ne "") {
1978 $contents .= "\n";
1979 dump_section($file, $section, $contents);
1980 $section = $section_default;
1981 $contents = "";
1982 }
1983 } elsif (/$doc_inline_start/) {
1984 $state = STATE_INLINE;
1985 $inline_doc_state = STATE_INLINE_NAME;
1986 } elsif ($decl_type eq 'function') {
1987 process_proto_function($_, $file);
1988 } else {
1989 process_proto_type($_, $file);
1990 }
1991}
1992
1993
1968sub process_file($) { 1994sub process_file($) {
1969 my $file; 1995 my $file;
1970 my $func; 1996 my $func;
@@ -2031,24 +2057,8 @@ sub process_file($) {
2031 ++$warnings; 2057 ++$warnings;
2032 } 2058 }
2033 } 2059 }
2034 } elsif ($state == STATE_PROTO) { # scanning for function '{' (end of prototype) 2060 } elsif ($state == STATE_PROTO) {
2035 if (/$doc_inline_oneline/) { 2061 process_proto($file, $_);
2036 $section = $1;
2037 $contents = $2;
2038 if ($contents ne "") {
2039 $contents .= "\n";
2040 dump_section($file, $section, $contents);
2041 $section = $section_default;
2042 $contents = "";
2043 }
2044 } elsif (/$doc_inline_start/) {
2045 $state = STATE_INLINE;
2046 $inline_doc_state = STATE_INLINE_NAME;
2047 } elsif ($decl_type eq 'function') {
2048 process_proto_function($_, $file);
2049 } else {
2050 process_proto_type($_, $file);
2051 }
2052 } elsif ($state == STATE_DOCBLOCK) { 2062 } elsif ($state == STATE_DOCBLOCK) {
2053 if (/$doc_end/) 2063 if (/$doc_end/)
2054 { 2064 {