#include "warning.h"
/** Number of occurred diagnostics. */
-unsigned diagnostic_count = 0;
+unsigned diagnostic_count = 0;
/** Number of occurred errors. */
-unsigned error_count = 0;
+unsigned error_count = 0;
/** Number of occurred warnings. */
-unsigned warning_count = 0;
-bool show_column = true;
+unsigned warning_count = 0;
+bool show_column = true;
+bool diagnostics_show_option = true;
static const source_position_t *curr_pos = NULL;
va_list ap;
va_start(ap, fmt);
warning_switch_t const *const s = get_warn_switch(warn);
- switch (s->level) {
- case WARN_LEVEL_OFF:
- break;
-
+ switch ((unsigned) s->state) {
char const* kind;
- case WARN_LEVEL_ON:
+ case WARN_STATE_ON:
if (is_warn_on(WARN_ERROR)) {
- case WARN_LEVEL_ERROR:
+ case WARN_STATE_ON | WARN_STATE_ERROR:
++error_count;
kind = "error";
} else {
+ case WARN_STATE_ON | WARN_STATE_NO_ERROR:
++warning_count;
kind = "warning";
}
diagnosticposvf(pos, kind, fmt, ap);
- fprintf(stderr, " [-W%s]\n", s->name);
+ if (diagnostics_show_option)
+ fprintf(stderr, " [-W%s]\n", s->name);
break;
default:
- panic("invalid warning level");
+ break;
}
va_end(ap);
}