X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fexamples_exist.c;h=7e9dd97cc8afa379ba227108e3fd0354c80b9aff;hb=d8c9fdc0e6b70ab4fced949ee6488dc585a711f4;hp=085f673a7e5ed506a6abe819911ef8e21af5a444;hpb=caf366998b97b7cc29bc1f33c285feb2f5d33bff;p=ccan diff --git a/tools/ccanlint/tests/examples_exist.c b/tools/ccanlint/tests/examples_exist.c index 085f673a..7e9dd97c 100644 --- a/tools/ccanlint/tests/examples_exist.c +++ b/tools/ccanlint/tests/examples_exist.c @@ -17,7 +17,6 @@ /* Creates and adds an example file. */ static char *add_example(struct manifest *m, struct ccan_file *source, - bool keep, struct doc_section *example) { char *name; @@ -34,7 +33,7 @@ static char *add_example(struct manifest *m, struct ccan_file *source, while (strchr(name, ' ')) *strchr(name, ' ') = '_'; - name = maybe_temp_file(m, ".c", keep, name); + name = temp_file(m, ".c", name); f = new_ccan_file(m, talloc_dirname(m, name), talloc_basename(m, name)); talloc_steal(f, name); list_add_tail(&m->examples, &f->list); @@ -59,7 +58,6 @@ static char *add_example(struct manifest *m, struct ccan_file *source, /* FIXME: We should have one example per function in header. */ static void extract_examples(struct manifest *m, - bool keep, unsigned int *timeleft, struct score *score) { @@ -70,7 +68,7 @@ static void extract_examples(struct manifest *m, score->total = 2; list_for_each(get_ccan_file_docs(m->info_file), d, list) { if (streq(d->type, "example")) { - score->error = add_example(m, m->info_file, keep, d); + score->error = add_example(m, m->info_file, d); if (score->error) return; have_info_example = true; @@ -86,7 +84,7 @@ static void extract_examples(struct manifest *m, mainh = f; list_for_each(get_ccan_file_docs(f), d, list) { if (streq(d->type, "example")) { - score->error = add_example(m, f, keep, d); + score->error = add_example(m, f, d); if (score->error) return; have_header_example = true; @@ -94,9 +92,10 @@ static void extract_examples(struct manifest *m, } } + /* We don't fail ccanlint for this. */ + score->pass = true; if (have_info_example && have_header_example) { score->score = score->total; - score->pass = true; return; } @@ -106,8 +105,6 @@ static void extract_examples(struct manifest *m, score_file_error(score, mainh, 0, "No Example: section"); score->score = have_info_example + have_header_example; - /* We pass if we find any example. */ - score->pass = score->score != 0; } struct ccanlint examples_exist = {