After "too many warnings" sparse continues to produce the rest of multiline
warnings.
test2.c:106:4: warning: incorrect type in assignment (different base types)
test2.c:106:4: expected int [signed] a
test2.c:106:4: got int *<noident>[0]
test2.c:107:4: warning: too many warnings
test2.c:106:4: expected int [signed] a
test2.c:106:4: got int *<noident>[0]
test2.c:106:4: expected int [signed] a
test2.c:106:4: got int *<noident>[0]
So introduce warning_info(). The only difference from info() is that
warning_info shuts up after certain amount of warnings.
--- 1.1236/evaluate.c 2005-01-18 13:46:08.000000000 +0200
+++ 1.1236-toomany/evaluate.c 2005-01-18 21:25:48.000000000 +0200
@@ -272,12 +272,15 @@ static struct symbol *bad_expr_type(stru
switch (expr->type) {
case EXPR_BINOP:
case EXPR_COMPARE:
- info(expr->pos, " left side has type %s",
show_typename(expr->left->ctype));
- info(expr->pos, " right side has type %s",
show_typename(expr->right->ctype));
+ warning_info(expr->pos, " left side has type %s",
+ show_typename(expr->left->ctype));
+ warning_info(expr->pos, " right side has type %s",
+ show_typename(expr->right->ctype));
break;
case EXPR_PREOP:
case EXPR_POSTOP:
- info(expr->pos, " argument has type %s",
show_typename(expr->unop->ctype));
+ warning_info(expr->pos, " argument has type %s",
+ show_typename(expr->unop->ctype));
break;
default:
break;
@@ -1086,8 +1089,8 @@ static int compatible_assignment_types(s
}
warning(expr->pos, "incorrect type in %s (%s)", where, typediff);
- info(expr->pos, " expected %s", show_typename(target));
- info(expr->pos, " got %s", show_typename(source));
+ warning_info(expr->pos, " expected %s", show_typename(target));
+ warning_info(expr->pos, " got %s", show_typename(source));
*rp = cast_to(*rp, target);
return 0;
Cast:
--- 1.1236/lib.c 2005-01-18 13:45:54.000000000 +0200
+++ 1.1236-toomany/lib.c 2005-01-18 21:30:36.000000000 +0200
@@ -302,12 +302,13 @@ void info(struct position pos, const cha
va_end(args);
}
+static int warnings_nr = 0;
+
void warning(struct position pos, const char * fmt, ...)
{
- static int warnings = 0;
va_list args;
- if (warnings > 100) {
+ if (warnings_nr > 100) {
static int once = 0;
if (once)
return;
@@ -318,9 +319,21 @@ void warning(struct position pos, const
va_start(args, fmt);
do_warn("warning: ", pos, fmt, args);
va_end(args);
- warnings++;
+ warnings_nr++;
}
+void warning_info(struct position pos, const char *fmt, ...)
+{
+ va_list args;
+
+ if (warnings_nr > 100 + 1)
+ return;
+
+ va_start(args, fmt);
+ do_warn("", pos, fmt, args);
+ va_end(args);
+}
+
void error(struct position pos, const char * fmt, ...)
{
static int errors = 0;
--- 1.1236/lib.h 2005-01-18 13:45:54.000000000 +0200
+++ 1.1236-toomany/lib.h 2005-01-18 21:11:08.000000000 +0200
@@ -71,6 +71,7 @@ struct token *expect(struct token *, int
extern void die(const char *, ...) FORMAT_ATTR(1);
extern void info(struct position, const char *, ...) FORMAT_ATTR(2);
extern void warning(struct position, const char *, ...) FORMAT_ATTR(2);
+extern void warning_info(struct position, const char *, ...) FORMAT_ATTR(2);
extern void error(struct position, const char *, ...) FORMAT_ATTR(2);
extern void error_die(struct position, const char *, ...) FORMAT_ATTR(2);
#undef FORMAT_ATTR
--- 1.1236/pre-process.c 2005-01-18 13:45:54.000000000 +0200
+++ 1.1236-toomany/pre-process.c 2005-01-18 21:41:25.000000000 +0200
@@ -1044,7 +1044,8 @@ static int do_handle_define(struct strea
return 1;
warning(left->pos, "preprocessor token %.*s redefined",
name->len, name->name);
- info(sym->pos, "this was the original definition");
+ warning_info(sym->pos,
+ "this was the original definition");
sym->expansion = expansion;
sym->arglist = arglist;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html