diff options
Diffstat (limited to 'scripts/kernel-doc')
| -rwxr-xr-x | scripts/kernel-doc | 24 | 
1 files changed, 19 insertions, 5 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 4305b2f2ec5..16a07cfa4d3 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -257,6 +257,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',  		'July', 'August', 'September', 'October',  		'November', 'December')[(localtime)[4]] .    " " . ((localtime)[5]+1900); +my $show_not_found = 0;  # Essentially these are globals.  # They probably want to be tidied up, made more localised or something. @@ -369,6 +370,8 @@ while ($ARGV[0] =~ m/^-(.*)/) {  	usage();      } elsif ($cmd eq '-no-doc-sections') {  	    $no_doc_sections = 1; +    } elsif ($cmd eq '-show-not-found') { +	$show_not_found = 1;      }  } @@ -2070,6 +2073,7 @@ sub check_return_section {  sub dump_function($$) {      my $prototype = shift;      my $file = shift; +    my $noret = 0;      $prototype =~ s/^static +//;      $prototype =~ s/^extern +//; @@ -2083,7 +2087,7 @@ sub dump_function($$) {      $prototype =~ s/__init_or_module +//;      $prototype =~ s/__must_check +//;      $prototype =~ s/__weak +//; -    $prototype =~ s/^#\s*define\s+//; #ak added +    my $define = $prototype =~ s/^#\s*define\s+//; #ak added      $prototype =~ s/__attribute__\s*\(\([a-z,]*\)\)//;      # Yes, this truly is vile.  We are looking for: @@ -2102,7 +2106,15 @@ sub dump_function($$) {      # - atomic_set (macro)      # - pci_match_device, __copy_to_user (long return type) -    if ($prototype =~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || +    if ($define && $prototype =~ m/^()([a-zA-Z0-9_~:]+)\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/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||  	$prototype =~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||  	$prototype =~ m/^(\w+\s*\*)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ ||  	$prototype =~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || @@ -2125,8 +2137,7 @@ sub dump_function($$) {  	create_parameterlist($args, ',', $file);      } else { -	print STDERR "Error(${file}:$.): cannot understand prototype: '$prototype'\n"; -	++$errors; +	print STDERR "Warning(${file}:$.): cannot understand function prototype: '$prototype'\n";  	return;      } @@ -2138,7 +2149,7 @@ sub dump_function($$) {          # of warnings goes sufficiently down, the check is only performed in          # verbose mode.          # TODO: always perform the check. -        if ($verbose) { +        if ($verbose && !$noret) {                  check_return_section($file, $declaration_name, $return_type);          } @@ -2536,6 +2547,9 @@ sub process_file($) {      }      if ($initial_section_counter == $section_counter) {  	print STDERR "Warning(${file}): no structured comments found\n"; +	if (($function_only == 1) && ($show_not_found == 1)) { +	    print STDERR "    Was looking for '$_'.\n" for keys %function_table; +	}  	if ($output_mode eq "xml") {  	    # The template wants at least one RefEntry here; make one.  	    print "<refentry>\n";  | 
