kernel-doc (d27625c9d55bb671c1c6b3a7f2c2b50e9175f958) | kernel-doc (0c9aa209579d41c9b8bf1fc39ce042bea2ec422d) |
---|---|
1#!/usr/bin/perl -w 2 3use strict; 4 5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## 6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## 7## Copyright (C) 2001 Simon Huggins ## 8## Copyright (C) 2005-2012 Randy Dunlap ## --- 190 unchanged lines hidden (view full) --- 199# 'funcname()' - function 200# '$ENVVAR' - environmental variable 201# '&struct_name' - name of a structure (up to two words including 'struct') 202# '@parameter' - name of a parameter 203# '%CONST' - name of a constant. 204 205## init lots of data 206 | 1#!/usr/bin/perl -w 2 3use strict; 4 5## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## 6## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## 7## Copyright (C) 2001 Simon Huggins ## 8## Copyright (C) 2005-2012 Randy Dunlap ## --- 190 unchanged lines hidden (view full) --- 199# 'funcname()' - function 200# '$ENVVAR' - environmental variable 201# '&struct_name' - name of a structure (up to two words including 'struct') 202# '@parameter' - name of a parameter 203# '%CONST' - name of a constant. 204 205## init lots of data 206 |
207 |
|
207my $errors = 0; 208my $warnings = 0; 209my $anon_struct_union = 0; 210 211# match expressions used to find embedded type information 212my $type_constant = '\%([-_\w]+)'; 213my $type_func = '(\w+)\(\)'; | 208my $errors = 0; 209my $warnings = 0; 210my $anon_struct_union = 0; 211 212# match expressions used to find embedded type information 213my $type_constant = '\%([-_\w]+)'; 214my $type_func = '(\w+)\(\)'; |
214my $type_param = '\@(\w+)'; | 215my $type_param = '\@(\w+(\.\.\.)?)'; |
215my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params 216my $type_struct = '\&((struct\s*)*[_\w]+)'; 217my $type_struct_xml = '\\&((struct\s*)*[_\w]+)'; 218my $type_env = '(\$\w+)'; 219my $type_enum_full = '\&(enum)\s*([_\w]+)'; 220my $type_struct_full = '\&(struct)\s*([_\w]+)'; 221my $type_typedef_full = '\&(typedef)\s*([_\w]+)'; 222my $type_union_full = '\&(union)\s*([_\w]+)'; --- 192 unchanged lines hidden (view full) --- 415# @params and a strictly limited set of supported section names 416my $doc_sect = $doc_com . 417 '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)'; 418my $doc_content = $doc_com_body . '(.*)'; 419my $doc_block = $doc_com . 'DOC:\s*(.*)?'; 420my $doc_inline_start = '^\s*/\*\*\s*$'; 421my $doc_inline_sect = '\s*\*\s*(@[\w\s]+):(.*)'; 422my $doc_inline_end = '^\s*\*/\s*$'; | 216my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params 217my $type_struct = '\&((struct\s*)*[_\w]+)'; 218my $type_struct_xml = '\\&((struct\s*)*[_\w]+)'; 219my $type_env = '(\$\w+)'; 220my $type_enum_full = '\&(enum)\s*([_\w]+)'; 221my $type_struct_full = '\&(struct)\s*([_\w]+)'; 222my $type_typedef_full = '\&(typedef)\s*([_\w]+)'; 223my $type_union_full = '\&(union)\s*([_\w]+)'; --- 192 unchanged lines hidden (view full) --- 416# @params and a strictly limited set of supported section names 417my $doc_sect = $doc_com . 418 '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)'; 419my $doc_content = $doc_com_body . '(.*)'; 420my $doc_block = $doc_com . 'DOC:\s*(.*)?'; 421my $doc_inline_start = '^\s*/\*\*\s*$'; 422my $doc_inline_sect = '\s*\*\s*(@[\w\s]+):(.*)'; 423my $doc_inline_end = '^\s*\*/\s*$'; |
424my $doc_inline_oneline = '^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$'; |
|
423my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;'; 424 425my %parameterdescs; 426my %parameterdesc_start_lines; 427my @parameterlist; 428my %sections; 429my @sectionlist; 430my %section_start_lines; --- 1917 unchanged lines hidden (view full) --- 2348 } 2349 2350 $anon_struct_union = 0; 2351 my $param_name = $param; 2352 $param_name =~ s/\[.*//; 2353 2354 if ($type eq "" && $param =~ /\.\.\.$/) 2355 { | 425my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;'; 426 427my %parameterdescs; 428my %parameterdesc_start_lines; 429my @parameterlist; 430my %sections; 431my @sectionlist; 432my %section_start_lines; --- 1917 unchanged lines hidden (view full) --- 2350 } 2351 2352 $anon_struct_union = 0; 2353 my $param_name = $param; 2354 $param_name =~ s/\[.*//; 2355 2356 if ($type eq "" && $param =~ /\.\.\.$/) 2357 { |
2356 $param = "..."; | 2358 if (!$param =~ /\w\.\.\.$/) { 2359 # handles unnamed variable parameters 2360 $param = "..."; 2361 } |
2357 if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") { 2358 $parameterdescs{$param} = "variable arguments"; 2359 } 2360 } 2361 elsif ($type eq "" && ($param eq "" or $param eq "void")) 2362 { 2363 $param="void"; 2364 $parameterdescs{void} = "no arguments"; --- 650 unchanged lines hidden (view full) --- 3015 } elsif ($inline_doc_state == STATE_INLINE_NAME) { 3016 $inline_doc_state = STATE_INLINE_ERROR; 3017 print STDERR "${file}:$.: warning: "; 3018 print STDERR "Incorrect use of kernel-doc format: $_"; 3019 ++$warnings; 3020 } 3021 } 3022 } elsif ($state == STATE_PROTO) { # scanning for function '{' (end of prototype) | 2362 if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") { 2363 $parameterdescs{$param} = "variable arguments"; 2364 } 2365 } 2366 elsif ($type eq "" && ($param eq "" or $param eq "void")) 2367 { 2368 $param="void"; 2369 $parameterdescs{void} = "no arguments"; --- 650 unchanged lines hidden (view full) --- 3020 } elsif ($inline_doc_state == STATE_INLINE_NAME) { 3021 $inline_doc_state = STATE_INLINE_ERROR; 3022 print STDERR "${file}:$.: warning: "; 3023 print STDERR "Incorrect use of kernel-doc format: $_"; 3024 ++$warnings; 3025 } 3026 } 3027 } elsif ($state == STATE_PROTO) { # scanning for function '{' (end of prototype) |
3023 if (/$doc_inline_start/) { | 3028 if (/$doc_inline_oneline/) { 3029 $section = $1; 3030 $contents = $2; 3031 if ($contents ne "") { 3032 $contents .= "\n"; 3033 dump_section($file, $section, xml_escape($contents)); 3034 $section = $section_default; 3035 $contents = ""; 3036 } 3037 } elsif (/$doc_inline_start/) { |
3024 $state = STATE_INLINE; 3025 $inline_doc_state = STATE_INLINE_NAME; 3026 } elsif ($decl_type eq 'function') { 3027 process_proto_function($_, $file); 3028 } else { 3029 process_proto_type($_, $file); 3030 } 3031 } elsif ($state == STATE_DOCBLOCK) { --- 111 unchanged lines hidden --- | 3038 $state = STATE_INLINE; 3039 $inline_doc_state = STATE_INLINE_NAME; 3040 } elsif ($decl_type eq 'function') { 3041 process_proto_function($_, $file); 3042 } else { 3043 process_proto_type($_, $file); 3044 } 3045 } elsif ($state == STATE_DOCBLOCK) { --- 111 unchanged lines hidden --- |