diff options
author | katherine <k@airen-no-jikken.icu> | 2019-05-30 20:38:25 -0700 |
---|---|---|
committer | katherine <k@airen-no-jikken.icu> | 2019-05-30 20:38:25 -0700 |
commit | 233bac703ee5849cb18d02330ccb97038ffc6439 (patch) | |
tree | e76ac7321b6051c082790934a18808f627747684 /src/parse.c | |
parent | 85456307365f470378df2f5e7fc3a355bc3d4ace (diff) | |
download | confconf-233bac703ee5849cb18d02330ccb97038ffc6439.tar.gz |
uthash location header warning
Diffstat (limited to 'src/parse.c')
-rw-r--r-- | src/parse.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/parse.c b/src/parse.c index 752e0b8..8b8f699 100644 --- a/src/parse.c +++ b/src/parse.c @@ -447,11 +447,13 @@ struct parse_result_s parse(FILE *f, const char *fname) ERR_AT(t.line, t.col, "unexpected token `%s`", t.val); } + /* err >0 rules */ if (r.vars == NULL) { fprintf(stderr, "\x1B[1m%s:\x1B[0m ", fname); ERR("config must specify at fewest one variable rule"); } + /* err undefined type */ HASH_ITER(hh, r.vars, vcur, vtmp) { switch (vcur->type) { case PARSE_TYPE_DEFTYPE: @@ -474,6 +476,7 @@ struct parse_result_s parse(FILE *f, const char *fname) } } + /* warn type use */ HASH_ITER(hh, r.deftypes, dcur, dtmp) { if (!dcur->is_used) { WARN_AT(dcur->line, dcur->col, @@ -482,12 +485,17 @@ struct parse_result_s parse(FILE *f, const char *fname) } } - if (!r.location_seen) { - fprintf(stderr, "\x1B[1m%s:\x1B[0m ", fname); - WARN("no uthash location header specified. using `<uthash.h>`"); - strcpy(r.location, "<uthash.h>"); + /* warn hash location */ + HASH_ITER(hh, r.vars, vcur, vtmp) { + if (vcur->type >= PARSE_TYPE_HASH_BOOL && !r.location_seen) { + fprintf(stderr, "\x1B[1m%s:\x1B[0m ", fname); + WARN("no uthash location header specified. using `<uthash.h>`"); + strcpy(r.location, "<uthash.h>"); + break; + } } + /* warn/err suffix */ if (!r.suffix_seen) { j = 0; |