aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2017-11-20 13:40:40 -0500
committerJonathan Corbet <corbet@lwn.net>2017-11-20 14:09:11 -0500
commit3a025e1d1c2ea42fa497c9c6b21c284e0f69e28b (patch)
tree82ed4e7dfbd05c14aa0e108e0c3d173504903c86 /scripts/kernel-doc
parente7e61fc0ba7b92153e17f1f707d2b7b3d52c0588 (diff)
Add optional check for bad kernel-doc comments
Implement a '-none' output mode for kernel-doc which will only output warning messages, and suppresses the warning message about there being no kernel-doc in the file. If the build has requested additional warnings, automatically check all .c files. This patch does not check .h files. Enabling the warning by default would add about 1300 warnings, so it's default off for now. People who care can use this to check they didn't break the docs and maybe we'll get all the warnings fixed and be able to enable this check by default in the future. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc25
1 files changed, 24 insertions, 1 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 67d051edd615..3bb43cb014b7 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -58,6 +58,7 @@ Output format selection (mutually exclusive):
58 -man Output troff manual page format. This is the default. 58 -man Output troff manual page format. This is the default.
59 -rst Output reStructuredText format. 59 -rst Output reStructuredText format.
60 -text Output plain text format. 60 -text Output plain text format.
61 -none Do not output documentation, only warnings.
61 62
62Output selection (mutually exclusive): 63Output selection (mutually exclusive):
63 -export Only output documentation for symbols that have been 64 -export Only output documentation for symbols that have been
@@ -532,6 +533,8 @@ while ($ARGV[0] =~ m/^-(.*)/) {
532 $output_mode = "gnome"; 533 $output_mode = "gnome";
533 @highlights = @highlights_gnome; 534 @highlights = @highlights_gnome;
534 $blankline = $blankline_gnome; 535 $blankline = $blankline_gnome;
536 } elsif ($cmd eq "-none") {
537 $output_mode = "none";
535 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document 538 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
536 $modulename = shift @ARGV; 539 $modulename = shift @ARGV;
537 } elsif ($cmd eq "-function") { # to only output specific functions 540 } elsif ($cmd eq "-function") { # to only output specific functions
@@ -2117,6 +2120,24 @@ sub output_blockhead_list(%) {
2117 } 2120 }
2118} 2121}
2119 2122
2123
2124## none mode output functions
2125
2126sub output_function_none(%) {
2127}
2128
2129sub output_enum_none(%) {
2130}
2131
2132sub output_typedef_none(%) {
2133}
2134
2135sub output_struct_none(%) {
2136}
2137
2138sub output_blockhead_none(%) {
2139}
2140
2120## 2141##
2121# generic output function for all types (function, struct/union, typedef, enum); 2142# generic output function for all types (function, struct/union, typedef, enum);
2122# calls the generated, variable output_ function name based on 2143# calls the generated, variable output_ function name based on
@@ -3145,7 +3166,9 @@ sub process_file($) {
3145 } 3166 }
3146 } 3167 }
3147 if ($initial_section_counter == $section_counter) { 3168 if ($initial_section_counter == $section_counter) {
3148 print STDERR "${file}:1: warning: no structured comments found\n"; 3169 if ($output_mode ne "none") {
3170 print STDERR "${file}:1: warning: no structured comments found\n";
3171 }
3149 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) { 3172 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) {
3150 print STDERR " Was looking for '$_'.\n" for keys %function_table; 3173 print STDERR " Was looking for '$_'.\n" for keys %function_table;
3151 } 3174 }