X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Fheaders_idempotent.c;fp=tools%2Fccanlint%2Ftests%2Fheaders_idempotent.c;h=1b2916bda3cb1ec1293ba59f7cda7f4b5ea6f8c8;hb=c9d946d07ae9a270042bcfef2bccfa09de6bddd9;hp=55fa9974b6d37c08edd6fc004e7068fdf25be974;hpb=925a9a8646a2e23d4e9f4b8ce446b76f647f183f;p=ccan diff --git a/tools/ccanlint/tests/headers_idempotent.c b/tools/ccanlint/tests/headers_idempotent.c index 55fa9974..1b2916bd 100644 --- a/tools/ccanlint/tests/headers_idempotent.c +++ b/tools/ccanlint/tests/headers_idempotent.c @@ -125,9 +125,10 @@ static void check_idem(struct ccan_file *f, struct score *score) if (!f->lines[i]) return; - /* We expect a condition on this line. */ + /* We expect a condition around this line. */ if (!line_info[i].cond) { - score_file_error(score, f, i+1, "Expected #ifndef"); + score_file_error(score, f, first_preproc_line+1, + "Expected #ifndef"); return; } @@ -136,7 +137,8 @@ static void check_idem(struct ccan_file *f, struct score *score) /* We expect the condition to be ! IFDEF . */ if (line_info[i].cond->type != PP_COND_IFDEF || !line_info[i].cond->inverse) { - score_file_error(score, f, i+1, "Expected #ifndef"); + score_file_error(score, f, first_preproc_line+1, + "Expected #ifndef"); return; } @@ -157,6 +159,9 @@ static void check_idem(struct ccan_file *f, struct score *score) return; } + /* Record this for use in depends_accurate */ + f->idempotent_cond = line_info[i].cond; + /* Rest of code should all be covered by that conditional. */ for (i++; f->lines[i]; i++) { unsigned int val = 0;