X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fheaders_idempotent.c;h=bf8c9f2dad8e61e406c40b6399aeae98fa12129b;hb=87c679ff36d7b198862cd2652a384d90f89f3b2b;hp=a1d30961f2035bc0dadbd9d557d9444f78f2edd5;hpb=7bb7cd58c2d9df126dd6072e5f3bec1eb4dc916b;p=ccan diff --git a/tools/ccanlint/tests/headers_idempotent.c b/tools/ccanlint/tests/headers_idempotent.c index a1d30961..bf8c9f2d 100644 --- a/tools/ccanlint/tests/headers_idempotent.c +++ b/tools/ccanlint/tests/headers_idempotent.c @@ -27,7 +27,7 @@ static void fix_name(char *name) unsigned int i; for (i = 0; name[i]; i++) { - if (isalnum(name[i])) + if (cisalnum(name[i])) name[i] = toupper(name[i]); else name[i] = '_'; @@ -58,7 +58,7 @@ static void handle_idem(struct manifest *m, struct score *score) if (!ask(q)) continue; - tmpname = maybe_temp_file(score, ".h", false, e->file->name); + tmpname = temp_file(score, ".h", e->file->name); out = fopen(tmpname, "w"); if (!out) err(1, "Opening %s", tmpname); @@ -145,18 +145,16 @@ static void check_idem(struct ccan_file *f, struct score *score) if (!get_token(&line, "#")) abort(); if (!get_token(&line, "define")) { - char *str = talloc_asprintf(score, - "expected '#define %s'", - line_info[i].cond->symbol); - score_file_error(score, f, i+1, str); + score_file_error(score, f, i+1, + "expected '#define %s'", + line_info[i].cond->symbol); return; } sym = get_symbol_token(f, &line); if (!sym || !streq(sym, line_info[i].cond->symbol)) { - char *str = talloc_asprintf(score, - "expected '#define %s'", - line_info[i].cond->symbol); - score_file_error(score, f, i+1, str); + score_file_error(score, f, i+1, + "expected '#define %s'", + line_info[i].cond->symbol); return; } @@ -176,16 +174,17 @@ static void check_idem(struct ccan_file *f, struct score *score) } static void check_idempotent(struct manifest *m, - bool keep, unsigned int *timeleft, struct score *score) { struct ccan_file *f; + /* We don't fail ccanlint for this. */ + score->pass = true; + list_for_each(&m->h_files, f, list) { check_idem(f, score); } if (!score->error) { - score->pass = true; score->score = score->total; } } @@ -195,7 +194,7 @@ struct ccanlint headers_idempotent = { .name = "Module headers are #ifndef/#define wrapped", .check = check_idempotent, .handle = handle_idem, - .needs = "" + .needs = "info_exists main_header_exists" }; REGISTER_TEST(headers_idempotent);