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: fix type name in message 101 for w...



details:   https://anonhg.NetBSD.org/src/rev/a8b427d25e2f
branches:  trunk
changeset: 380007:a8b427d25e2f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jun 30 14:11:08 2021 +0000

description:
lint: fix type name in message 101 for wrong member name

diffstat:

 tests/usr.bin/xlint/lint1/msg_101.c   |  15 ++++++---------
 tests/usr.bin/xlint/lint1/msg_101.exp |  12 ++++++------
 tests/usr.bin/xlint/lint1/msg_215.c   |   5 ++---
 tests/usr.bin/xlint/lint1/msg_215.exp |   4 ++--
 usr.bin/xlint/lint1/tree.c            |   6 +++---
 5 files changed, 19 insertions(+), 23 deletions(-)

diffs (108 lines):

diff -r 973fecc2f06c -r a8b427d25e2f tests/usr.bin/xlint/lint1/msg_101.c
--- a/tests/usr.bin/xlint/lint1/msg_101.c       Wed Jun 30 14:02:11 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_101.c       Wed Jun 30 14:11:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_101.c,v 1.5 2021/06/30 14:02:11 rillig Exp $       */
+/*     $NetBSD: msg_101.c,v 1.6 2021/06/30 14:11:08 rillig Exp $       */
 # 3 "msg_101.c"
 
 // Test for message: type '%s' does not have member '%s' [101]
@@ -17,11 +17,9 @@ test(const struct point *ptr, const stru
        sink(pt.x);
 
        /* accessing a nonexistent member */
-       /* FIXME: "type 'int'" is wrong. */
-       /* expect+1: error: type 'int' does not have member 'z' [101] */
+       /* expect+1: error: type 'pointer to const struct point' does not have member 'z' [101] */
        sink(ptr->z);
-       /* FIXME: "type 'int'" is wrong. */
-       /* expect+1: error: type 'int' does not have member 'z' [101] */
+       /* expect+1: error: type 'const struct point' does not have member 'z' [101] */
        sink(pt.z);
 
        /* mixed up '.' and '->' */
@@ -33,10 +31,9 @@ test(const struct point *ptr, const stru
        sink(pt->x);
 
        /* accessing a nonexistent member via the wrong operator */
-       /* FIXME: "type 'int'" is wrong. */
-       /* expect+1: error: type 'int' does not have member 'z' [101] */
+       /* expect+1: error: type 'pointer to const struct point' does not have member 'z' [101] */
        sink(ptr.z);
-       /* FIXME: "type 'int'" is wrong. */
-       /* expect+1: error: type 'int' does not have member 'z' [101] */
+       /* XXX: Why is the 'const' missing here, but not above? */
+       /* expect+1: error: type 'struct point' does not have member 'z' [101] */
        sink(pt->z);
 }
diff -r 973fecc2f06c -r a8b427d25e2f tests/usr.bin/xlint/lint1/msg_101.exp
--- a/tests/usr.bin/xlint/lint1/msg_101.exp     Wed Jun 30 14:02:11 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_101.exp     Wed Jun 30 14:11:08 2021 +0000
@@ -1,6 +1,6 @@
-msg_101.c(22): error: type 'int' does not have member 'z' [101]
-msg_101.c(25): error: type 'int' does not have member 'z' [101]
-msg_101.c(30): error: left operand of '.' must be struct/union object [103]
-msg_101.c(33): error: left operand of '->' must be pointer to struct/union not struct point [104]
-msg_101.c(38): error: type 'int' does not have member 'z' [101]
-msg_101.c(41): error: type 'int' does not have member 'z' [101]
+msg_101.c(21): error: type 'pointer to const struct point' does not have member 'z' [101]
+msg_101.c(23): error: type 'const struct point' does not have member 'z' [101]
+msg_101.c(28): error: left operand of '.' must be struct/union object [103]
+msg_101.c(31): error: left operand of '->' must be pointer to struct/union not struct point [104]
+msg_101.c(35): error: type 'pointer to const struct point' does not have member 'z' [101]
+msg_101.c(38): error: type 'struct point' does not have member 'z' [101]
diff -r 973fecc2f06c -r a8b427d25e2f tests/usr.bin/xlint/lint1/msg_215.c
--- a/tests/usr.bin/xlint/lint1/msg_215.c       Wed Jun 30 14:02:11 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_215.c       Wed Jun 30 14:11:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_215.c,v 1.4 2021/06/30 13:50:15 rillig Exp $       */
+/*     $NetBSD: msg_215.c,v 1.5 2021/06/30 14:11:08 rillig Exp $       */
 # 3 "msg_215.c"
 
 // Test for message: function implicitly declared to return int [215]
@@ -20,8 +20,7 @@ test(struct str str)
        /* expect+1: error: function implicitly declared to return int [215] */
        name();
 
-       /* FIXME: "type 'int'" sounds wrong. */
-       /* expect+2: error: type 'int' does not have member 'member' [101] */
+       /* expect+2: error: type 'struct str' does not have member 'member' [101] */
        /* expect+1: error: illegal function (type int) [149] */
        str.member();
 }
diff -r 973fecc2f06c -r a8b427d25e2f tests/usr.bin/xlint/lint1/msg_215.exp
--- a/tests/usr.bin/xlint/lint1/msg_215.exp     Wed Jun 30 14:02:11 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_215.exp     Wed Jun 30 14:11:08 2021 +0000
@@ -1,3 +1,3 @@
 msg_215.c(21): error: function implicitly declared to return int [215]
-msg_215.c(26): error: type 'int' does not have member 'member' [101]
-msg_215.c(26): error: illegal function (type int) [149]
+msg_215.c(25): error: type 'struct str' does not have member 'member' [101]
+msg_215.c(25): error: illegal function (type int) [149]
diff -r 973fecc2f06c -r a8b427d25e2f usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Wed Jun 30 14:02:11 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Wed Jun 30 14:11:08 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.299 2021/06/30 12:28:03 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.300 2021/06/30 14:11:08 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.299 2021/06/30 12:28:03 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.300 2021/06/30 14:11:08 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -333,7 +333,7 @@ struct_or_union_member(tnode_t *tn, op_t
         */
        if (msym->s_scl == NOSCL) {
                /* type '%s' does not have member '%s' */
-               error(101, type_name(msym->s_type), msym->s_name);
+               error(101, type_name(tn->tn_type), msym->s_name);
                rmsym(msym);
                msym->s_kind = FMEMBER;
                msym->s_scl = MOS;



Home | Main Index | Thread Index | Old Index