X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=diagnostic.c;h=7d8c0abaa2ed118a10e8f28c0ccb311660c69a13;hb=3bacbd8004ed7a87d9241cde66b9990643da5c5b;hp=4a9122c8701978f9c53629f3742c801987760c6b;hpb=17ce4fb8276367fa61479f7258185240a28330be;p=cparser diff --git a/diagnostic.c b/diagnostic.c index 4a9122c..7d8c0ab 100644 --- a/diagnostic.c +++ b/diagnostic.c @@ -34,15 +34,14 @@ unsigned diagnostic_count = 0; unsigned error_count = 0; /** Number of occurred warnings. */ unsigned warning_count = 0; -/** true if warnings should be inhibited */ -bool inhibit_all_warnings = false; static const source_position_t *curr_pos = NULL; /** * prints an additional source position */ -static void print_source_position(FILE *out, const source_position_t *pos) { +static void print_source_position(FILE *out, const source_position_t *pos) +{ fprintf(out, "at line %u", pos->linenr); if (curr_pos == NULL || curr_pos->input_name != pos->input_name) fprintf(out, " of \"%s\"", pos->input_name); @@ -70,7 +69,7 @@ static void diagnosticvf(const char *const fmt, va_list ap) case 'C': { const wint_t val = va_arg(ap, wint_t); - fputwc(val, stderr); + fprintf(stderr, "%lc", val); break; } @@ -92,6 +91,12 @@ static void diagnosticvf(const char *const fmt, va_list ap) break; } + case 'u': { + const unsigned int val = va_arg(ap, unsigned int); + fprintf(stderr, "%u", val); + break; + } + case 'Y': { const symbol_t *const symbol = va_arg(ap, const symbol_t*); if (symbol == NULL) @@ -123,6 +128,12 @@ static void diagnosticvf(const char *const fmt, va_list ap) break; } + case 't': { + const token_t *const token = va_arg(ap, const token_t*); + print_pp_token(stderr, token); + break; + } + case 'K': { const token_t* const token = va_arg(ap, const token_t*); print_token(stderr, token); @@ -211,9 +222,6 @@ static void warningvf(const source_position_t *pos, void warningf(const source_position_t *pos, const char *const fmt, ...) { - if (inhibit_all_warnings) - return; - va_list ap; va_start(ap, fmt); curr_pos = pos;