After "too many warnings" sparse continues to produce the rest of multiline
warnings.

drivers/net/tokenring/ibmtr.c:1274:19: warning: incorrect type in argument 1 
(different base types)
drivers/net/tokenring/ibmtr.c:1274:19:    expected void const volatile 
[noderef] *addr<asn:2>
drivers/net/tokenring/ibmtr.c:1274:19:    got unsigned int srb
drivers/net/tokenring/ibmtr.c:1277:34: warning: too many warnings
drivers/net/tokenring/ibmtr.c:1277:34:    expected void const volatile 
[noderef] *addr<asn:2>
drivers/net/tokenring/ibmtr.c:1277:34:    got unsigned int

So introduce warning_info(). The only difference from info() is that
warning_info shuts up after certain amount of warnings.

diff -uprN 1.1240/evaluate.c 1.1240-toomany/evaluate.c
--- 1.1240/evaluate.c   2005-01-23 21:52:43.000000000 +0200
+++ 1.1240-toomany/evaluate.c   2005-01-24 21:32:53.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:
diff -uprN 1.1240/lib.c 1.1240-toomany/lib.c
--- 1.1240/lib.c        2005-01-23 21:52:43.000000000 +0200
+++ 1.1240-toomany/lib.c        2005-01-24 21:32:53.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;
diff -uprN 1.1240/lib.h 1.1240-toomany/lib.h
--- 1.1240/lib.h        2005-01-23 21:52:43.000000000 +0200
+++ 1.1240-toomany/lib.h        2005-01-24 21:32:53.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
diff -uprN 1.1240/pre-process.c 1.1240-toomany/pre-process.c
--- 1.1240/pre-process.c        2005-01-23 21:52:43.000000000 +0200
+++ 1.1240-toomany/pre-process.c        2005-01-24 21:32:53.000000000 +0200
@@ -1091,7 +1091,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

Reply via email to