lint: fix type name in message 101 for wrong member name
This commit is contained in:
parent
3390d7b90b
commit
19c3587496
|
@ -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 struct point pt)
|
|||
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 struct point pt)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 op, sym_t *msym)
|
|||
*/
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue