diff options
| -rw-r--r-- | lib.c | 14 | ||||
| -rw-r--r-- | lib.h | 1 | ||||
| -rw-r--r-- | sparse.1 | 6 |
3 files changed, 18 insertions, 3 deletions
@@ -115,7 +115,7 @@ static void do_warn(const char *type, struct position pos, const char * fmt, va_ name, pos.line, pos.pos, type, buffer); } -static int max_warnings = 100; +unsigned int fmax_warnings = 100; static int show_info = 1; void info(struct position pos, const char * fmt, ...) @@ -160,12 +160,12 @@ void warning(struct position pos, const char * fmt, ...) return; } - if (!max_warnings || has_error) { + if (!fmax_warnings || has_error) { show_info = 0; return; } - if (!--max_warnings) { + if (!--fmax_warnings) { show_info = 0; fmt = "too many warnings"; } @@ -611,6 +611,7 @@ static int opt_##NAME(const char *arg, const char *opt, TYPE *ptr, int flag) \ } OPT_NUMERIC(ullong, unsigned long long, strtoull) +OPT_NUMERIC(uint, unsigned int, strtoul) static char **handle_switch_o(char *arg, char **next) @@ -869,8 +870,15 @@ static int handle_fmemcpy_max_count(const char *arg, const char *opt, const stru return 1; } +static int handle_fmax_warnings(const char *arg, const char *opt, const struct flag *flag, int options) +{ + opt_uint(arg, opt, &fmax_warnings, OPTNUM_UNLIMITED); + return 1; +} + static struct flag fflags[] = { { "dump-ir", NULL, handle_fdump_ir }, + { "max-warnings=", NULL, handle_fmax_warnings }, { "mem-report", &fmem_report }, { "memcpy-max-count=", NULL, handle_fmemcpy_max_count }, { "tabstop=", NULL, handle_ftabstop }, @@ -167,6 +167,7 @@ extern int dump_macro_defs; extern int dbg_entry; extern int dbg_dead; +extern unsigned int fmax_warnings; extern int fmem_report; extern unsigned long fdump_ir; extern unsigned long long fmemcpy_max_count; @@ -20,6 +20,12 @@ off those warnings, pass the negation of the associated warning option, . .SH WARNING OPTIONS .TP +.B \-fmax-warnings=COUNT +Set the maximum number of displayed warnings to COUNT, which should be +a numerical value or 'unlimited'. +The default limit is 100. +. +.TP .B \-Wsparse\-all Turn on all sparse warnings, except for those explicitly disabled via \fB\-Wno\-something\fR. |
