Skip to content

Commit e946c43

Browse files
jmberg-inteltorvalds
authored andcommitted
kernel-doc: improve "no structured comments found" error
When using '!Ffile function' in a docbook template, and the function no longer exists, you get a "no structured comments found" error from the kernel-doc processing script. It's useful to know which functions it was looking for, so print them out in this case. Also do the same for '!Pfile doc-section' The same error also happens when using '!Efile' when some exported functions aren't documented (in the same file.) There's a very large number of such functions though, so don't print the message in this case -- right now it would give ~850 messages. Signed-off-by: Johannes Berg <[email protected]> Cc: Rob Landley <[email protected]> Cc: Randy Dunlap <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent c770864 commit e946c43

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

scripts/docproc.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ FILELINE * docsection;
7272
#define FUNCTION "-function"
7373
#define NOFUNCTION "-nofunction"
7474
#define NODOCSECTIONS "-no-doc-sections"
75+
#define SHOWNOTFOUND "-show-not-found"
7576

7677
static char *srctree, *kernsrctree;
7778

@@ -294,6 +295,7 @@ static void singfunc(char * filename, char * line)
294295
int startofsym = 1;
295296
vec[idx++] = KERNELDOC;
296297
vec[idx++] = DOCBOOK;
298+
vec[idx++] = SHOWNOTFOUND;
297299

298300
/* Split line up in individual parameters preceded by FUNCTION */
299301
for (i=0; line[i]; i++) {
@@ -325,7 +327,8 @@ static void singfunc(char * filename, char * line)
325327
*/
326328
static void docsect(char *filename, char *line)
327329
{
328-
char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */
330+
/* kerneldoc -docbook -show-not-found -function "section" file NULL */
331+
char *vec[7];
329332
char *s;
330333

331334
for (s = line; *s; s++)
@@ -341,10 +344,11 @@ static void docsect(char *filename, char *line)
341344

342345
vec[0] = KERNELDOC;
343346
vec[1] = DOCBOOK;
344-
vec[2] = FUNCTION;
345-
vec[3] = line;
346-
vec[4] = filename;
347-
vec[5] = NULL;
347+
vec[2] = SHOWNOTFOUND;
348+
vec[3] = FUNCTION;
349+
vec[4] = line;
350+
vec[5] = filename;
351+
vec[6] = NULL;
348352
exec_kernel_doc(vec);
349353
}
350354

scripts/kernel-doc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June',
257257
'July', 'August', 'September', 'October',
258258
'November', 'December')[(localtime)[4]] .
259259
" " . ((localtime)[5]+1900);
260+
my $show_not_found = 0;
260261

261262
# Essentially these are globals.
262263
# They probably want to be tidied up, made more localised or something.
@@ -369,6 +370,8 @@ while ($ARGV[0] =~ m/^-(.*)/) {
369370
usage();
370371
} elsif ($cmd eq '-no-doc-sections') {
371372
$no_doc_sections = 1;
373+
} elsif ($cmd eq '-show-not-found') {
374+
$show_not_found = 1;
372375
}
373376
}
374377

@@ -2536,6 +2539,9 @@ sub process_file($) {
25362539
}
25372540
if ($initial_section_counter == $section_counter) {
25382541
print STDERR "Warning(${file}): no structured comments found\n";
2542+
if (($function_only == 1) && ($show_not_found == 1)) {
2543+
print STDERR " Was looking for '$_'.\n" for keys %function_table;
2544+
}
25392545
if ($output_mode eq "xml") {
25402546
# The template wants at least one RefEntry here; make one.
25412547
print "<refentry>\n";

0 commit comments

Comments
 (0)