Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scripts: kernel-doc: apply filtering rules to warnings

When kernel-doc is called with output selection filters,
it will be called lots of time for a single file. If
there is a warning present there, it means that it may
print hundreds of identical warnings.

Worse than that, the -function NAME actually filters only
functions. So, it makes no sense at all to print warnings
for structs or enums.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
2defb272 84ce5b98

+23 -7
+23 -7
scripts/kernel-doc
··· 1160 1160 push @parameterlist, $arg; 1161 1161 if (!$parameterdescs{$arg}) { 1162 1162 $parameterdescs{$arg} = $undescribed; 1163 - print STDERR "${file}:$.: warning: Enum value '$arg' ". 1164 - "not described in enum '$declaration_name'\n"; 1163 + if (($output_selection == OUTPUT_ALL) || 1164 + ($output_selection == OUTPUT_INCLUDE && 1165 + defined($function_table{$declaration_name})) || 1166 + ($output_selection == OUTPUT_EXCLUDE && 1167 + !defined($function_table{$declaration_name}))) { 1168 + print STDERR "${file}:$.: warning: Enum value '$arg' not described in enum '$declaration_name'\n"; 1169 + } 1165 1170 } 1166 1171 $_members{$arg} = 1; 1167 1172 } 1168 1173 1169 1174 while (my ($k, $v) = each %parameterdescs) { 1170 1175 if (!exists($_members{$k})) { 1171 - print STDERR "${file}:$.: warning: Excess enum value " . 1172 - "'$k' description in '$declaration_name'\n"; 1176 + if (($output_selection == OUTPUT_ALL) || 1177 + ($output_selection == OUTPUT_INCLUDE && 1178 + defined($function_table{$declaration_name})) || 1179 + ($output_selection == OUTPUT_EXCLUDE && 1180 + !defined($function_table{$declaration_name}))) { 1181 + print STDERR "${file}:$.: warning: Excess enum value '$k' description in '$declaration_name'\n"; 1182 + } 1173 1183 } 1174 1184 } 1175 1185 ··· 1385 1375 if (!defined $parameterdescs{$param} && $param !~ /^#/) { 1386 1376 $parameterdescs{$param} = $undescribed; 1387 1377 1388 - print STDERR 1389 - "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n"; 1390 - ++$warnings; 1378 + if (($output_selection == OUTPUT_ALL) || 1379 + ($output_selection == OUTPUT_INCLUDE && 1380 + defined($function_table{$declaration_name})) || 1381 + ($output_selection == OUTPUT_EXCLUDE && 1382 + !defined($function_table{$declaration_name}))) { 1383 + print STDERR 1384 + "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n"; 1385 + ++$warnings; 1386 + } 1391 1387 } 1392 1388 1393 1389 $param = xml_escape($param);