kernel-doc (212209cff89fe497bc47abcd017aa95e4e8a5196) kernel-doc (3e58e839150db0857dfcb3a0bb3d4af4c6ac1abf)
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3
4use warnings;
5use strict;
6
7## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
8## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##

--- 2095 unchanged lines hidden (view full) ---

2104
2105 if ( $1 eq "" ) {
2106 $section = $section_intro;
2107 } else {
2108 $section = $1;
2109 }
2110 } elsif (/$doc_decl/o) {
2111 $identifier = $1;
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3
4use warnings;
5use strict;
6
7## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
8## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##

--- 2095 unchanged lines hidden (view full) ---

2104
2105 if ( $1 eq "" ) {
2106 $section = $section_intro;
2107 } else {
2108 $section = $1;
2109 }
2110 } elsif (/$doc_decl/o) {
2111 $identifier = $1;
2112 if (/\s*([\w\s]+?)(\(\))?\s*([-:].*)?$/) {
2112 my $is_kernel_comment = 0;
2113 if (/^\s*\*\s*([\w\s]+?)(\(\))?\s*([-:].*)?$/) {
2113 $identifier = $1;
2114 $identifier = $1;
2115 $decl_type = 'function';
2116 $identifier =~ s/^define\s+//;
2117 $is_kernel_comment = 1;
2114 }
2115 if ($identifier =~ m/^(struct|union|enum|typedef)\b\s*(\S*)/) {
2116 $decl_type = $1;
2117 $identifier = $2;
2118 }
2119 if ($identifier =~ m/^(struct|union|enum|typedef)\b\s*(\S*)/) {
2120 $decl_type = $1;
2121 $identifier = $2;
2118 } else {
2119 $decl_type = 'function';
2120 $identifier =~ s/^define\s+//;
2122 $is_kernel_comment = 1;
2121 }
2122 $identifier =~ s/\s+$//;
2123
2124 $state = STATE_BODY;
2125 # if there's no @param blocks need to set up default section
2126 # here
2127 $contents = "";
2128 $section = $section_default;

--- 5 unchanged lines hidden (view full) ---

2134 $descr =~ s/\s*$//;
2135 $descr =~ s/\s+/ /g;
2136 $declaration_purpose = $descr;
2137 $state = STATE_BODY_MAYBE;
2138 } else {
2139 $declaration_purpose = "";
2140 }
2141
2123 }
2124 $identifier =~ s/\s+$//;
2125
2126 $state = STATE_BODY;
2127 # if there's no @param blocks need to set up default section
2128 # here
2129 $contents = "";
2130 $section = $section_default;

--- 5 unchanged lines hidden (view full) ---

2136 $descr =~ s/\s*$//;
2137 $descr =~ s/\s+/ /g;
2138 $declaration_purpose = $descr;
2139 $state = STATE_BODY_MAYBE;
2140 } else {
2141 $declaration_purpose = "";
2142 }
2143
2144 if (!$is_kernel_comment) {
2145 print STDERR "${file}:$.: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst\n";
2146 print STDERR $_;
2147 ++$warnings;
2148 $state = STATE_NORMAL;
2149 }
2150
2142 if (($declaration_purpose eq "") && $verbose) {
2143 print STDERR "${file}:$.: warning: missing initial short description on line:\n";
2144 print STDERR $_;
2145 ++$warnings;
2146 }
2147
2148 if ($identifier eq "" && $decl_type ne "enum") {
2149 print STDERR "${file}:$.: warning: wrong kernel-doc identifier on line:\n";

--- 345 unchanged lines hidden ---
2151 if (($declaration_purpose eq "") && $verbose) {
2152 print STDERR "${file}:$.: warning: missing initial short description on line:\n";
2153 print STDERR $_;
2154 ++$warnings;
2155 }
2156
2157 if ($identifier eq "" && $decl_type ne "enum") {
2158 print STDERR "${file}:$.: warning: wrong kernel-doc identifier on line:\n";

--- 345 unchanged lines hidden ---