Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 more descriptive errors



details:   https://anonhg.NetBSD.org/src/rev/85b0d399e9ba
branches:  trunk
changeset: 341022:85b0d399e9ba
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Oct 14 18:31:52 2015 +0000

description:
more descriptive errors

diffstat:

 usr.bin/xlint/lint1/err.c  |  10 +++++-----
 usr.bin/xlint/lint1/tree.c |  15 ++++++++++-----
 2 files changed, 15 insertions(+), 10 deletions(-)

diffs (91 lines):

diff -r a603fd997d99 -r 85b0d399e9ba usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Wed Oct 14 16:33:42 2015 +0000
+++ b/usr.bin/xlint/lint1/err.c Wed Oct 14 18:31:52 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.48 2015/07/29 18:22:06 christos Exp $        */
+/*     $NetBSD: err.c,v 1.49 2015/10/14 18:31:52 christos Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: err.c,v 1.48 2015/07/29 18:22:06 christos Exp $");
+__RCSID("$NetBSD: err.c,v 1.49 2015/10/14 18:31:52 christos Exp $");
 #endif
 
 #include <sys/types.h>
@@ -182,7 +182,7 @@
        "bitwise operation on signed value nonportable",              /* 120 */
        "negative shift",                                             /* 121 */
        "shift greater than size of object",                          /* 122 */
-       "illegal combination of pointer and integer, op %s",          /* 123 */
+       "illegal combination of %s (%s) and %s (%s), op %s",          /* 123 */
        "illegal pointer combination, op %s",                         /* 124 */
        "ANSI C forbids ordered comparisons of pointers to functions",/* 125 */
        "incompatible types in conditional",                          /* 126 */
@@ -213,7 +213,7 @@
        "void expressions may not be arguments, arg #%d",             /* 151 */
        "argument cannot have unknown size, arg #%d",                 /* 152 */
        "argument has incompatible pointer type, arg #%d (%s != %s)", /* 153 */
-       "illegal combination of pointer and integer, arg #%d",        /* 154 */
+       "illegal combination of %s (%s) and %s (%s), arg #%d",        /* 154 */
        "argument is incompatible with prototype, arg #%d",           /* 155 */
        "enum type mismatch, arg #%d",                                /* 156 */
        "ANSI C treats constant as unsigned",                         /* 157 */
@@ -242,7 +242,7 @@
        "bit-field initializer does not fit",                         /* 180 */
        "{}-enclosed initializer required",                           /* 181 */
        "incompatible pointer types (%s != %s)",                      /* 182 */
-       "illegal combination of pointer and integer",                 /* 183 */
+       "illegal combination of %s (%s) and %s (%s)",                 /* 183 */
        "illegal pointer combination",                                /* 184 */
        "initialisation type mismatch",                               /* 185 */
        "bit-field initialisation is illegal in traditional C",       /* 186 */
diff -r a603fd997d99 -r 85b0d399e9ba usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Wed Oct 14 16:33:42 2015 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Wed Oct 14 18:31:52 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.81 2015/08/28 09:42:07 joerg Exp $  */
+/*     $NetBSD: tree.c,v 1.82 2015/10/14 18:31:52 christos Exp $       */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.81 2015/08/28 09:42:07 joerg Exp $");
+__RCSID("$NetBSD: tree.c,v 1.82 2015/10/14 18:31:52 christos Exp $");
 #endif
 
 #include <stdlib.h>
@@ -1243,19 +1243,24 @@
        }
 
        if ((lt == PTR && isityp(rt)) || (isityp(lt) && rt == PTR)) {
+               const char *lx = lt == PTR ? "pointer" : "integer";
+               const char *rx = rt == PTR ? "pointer" : "integer";
+               tyname(lbuf, sizeof(lbuf), ltp);
+               tyname(rbuf, sizeof(rbuf), rtp);
+
                switch (op) {
                case INIT:
                case RETURN:
                        /* illegal combination of pointer and integer */
-                       warning(183);
+                       warning(183, lx, lbuf, rx, rbuf);
                        break;
                case FARG:
                        /* illegal comb. of ptr. and int., arg #%d */
-                       warning(154, arg);
+                       warning(154, lx, lbuf, rx, rbuf, arg);
                        break;
                default:
                        /* illegal comb. of ptr. and int., op %s */
-                       warning(123, mp->m_name);
+                       warning(123, lx, lbuf, rx, rbuf, mp->m_name);
                        break;
                }
                return (1);



Home | Main Index | Thread Index | Old Index