Module Name: src Committed By: christos Date: Wed Oct 14 18:31:52 UTC 2015
Modified Files: src/usr.bin/xlint/lint1: err.c tree.c Log Message: more descriptive errors To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint1/err.c cvs rdiff -u -r1.81 -r1.82 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint1/err.c diff -u src/usr.bin/xlint/lint1/err.c:1.48 src/usr.bin/xlint/lint1/err.c:1.49 --- src/usr.bin/xlint/lint1/err.c:1.48 Wed Jul 29 14:22:06 2015 +++ src/usr.bin/xlint/lint1/err.c Wed Oct 14 14:31:52 2015 @@ -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 @@ const char *msgs[] = { "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 @@ const char *msgs[] = { "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 @@ const char *msgs[] = { "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 */ Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.81 src/usr.bin/xlint/lint1/tree.c:1.82 --- src/usr.bin/xlint/lint1/tree.c:1.81 Fri Aug 28 05:42:07 2015 +++ src/usr.bin/xlint/lint1/tree.c Wed Oct 14 14:31:52 2015 @@ -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 @@ asgntypok(op_t op, int arg, tnode_t *ln, } 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);