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 lint: add type information to message 275



details:   https://anonhg.NetBSD.org/src/rev/4fe777198b44
branches:  trunk
changeset: 950770:4fe777198b44
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 30 21:58:04 2021 +0000

description:
lint: add type information to message 275

Before: cast discards 'const' from pointer target type
After:  cast discards 'const' from type 'pointer to const char'

Seen in sqlite3.c.

diffstat:

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

diffs (56 lines):

diff -r caa8233db8a1 -r 4fe777198b44 usr.bin/xlint/lint1/err.c
--- a/usr.bin/xlint/lint1/err.c Sat Jan 30 21:49:08 2021 +0000
+++ b/usr.bin/xlint/lint1/err.c Sat Jan 30 21:58:04 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.c,v 1.71 2021/01/30 21:49:08 rillig Exp $  */
+/*     $NetBSD: err.c,v 1.72 2021/01/30 21:58:04 rillig 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.71 2021/01/30 21:49:08 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.72 2021/01/30 21:58:04 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -334,7 +334,7 @@
        "empty translation unit",                                     /* 272 */
        "bit-field type '%s' invalid in ANSI C",                      /* 273 */
        "ANSI C forbids comparison of %s with %s",                    /* 274 */
-       "cast discards 'const' from pointer target type",             /* 275 */
+       "cast discards 'const' from type '%s'",                       /* 275 */
        "__%s__ is illegal for type %s",                              /* 276 */
        "initialisation of '%s' with '%s'",                           /* 277 */
        "combination of '%s' and '%s', arg #%d",                      /* 278 */
diff -r caa8233db8a1 -r 4fe777198b44 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Sat Jan 30 21:49:08 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Sat Jan 30 21:58:04 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.195 2021/01/30 21:49:08 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.196 2021/01/30 21:58:04 rillig 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.195 2021/01/30 21:49:08 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.196 2021/01/30 21:58:04 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -3489,8 +3489,8 @@
        } else if (nt == PTR && ot == PTR) {
                if (!tp->t_subt->t_const && tn->tn_type->t_subt->t_const) {
                        if (hflag)
-                               /* cast discards 'const' from pointer tar... */
-                               warning(275);
+                               /* cast discards 'const' from type '%s' */
+                               warning(275, type_name(tn->tn_type));
                }
        } else {
                /* invalid cast expression */



Home | Main Index | Thread Index | Old Index