lint: document where to fix missing const in lvalue-to-rvalue

No functional change.
This commit is contained in:
rillig 2021-07-04 17:16:09 +00:00
parent 8b62008a54
commit 469326d25e
2 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg_101.c,v 1.7 2021/07/04 17:01:58 rillig Exp $ */
/* $NetBSD: msg_101.c,v 1.8 2021/07/04 17:16:09 rillig Exp $ */
# 3 "msg_101.c"
// Test for message: type '%s' does not have member '%s' [101]
@ -31,7 +31,7 @@ test(const struct point *ptr, const struct point pt)
/* accessing a nonexistent member via the wrong operator */
/* expect+1: error: type 'pointer to const struct point' does not have member 'z' [101] */
sink(ptr.z);
/* XXX: Why is the 'const' missing here, but not above? */
/* FIXME: In cconv, don't set t_const unconditionally to false. */
/* expect+1: error: type 'struct point' does not have member 'z' [101] */
sink(pt->z);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tree.c,v 1.310 2021/07/04 17:01:58 rillig Exp $ */
/* $NetBSD: tree.c,v 1.311 2021/07/04 17:16:09 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.310 2021/07/04 17:01:58 rillig Exp $");
__RCSID("$NetBSD: tree.c,v 1.311 2021/07/04 17:16:09 rillig Exp $");
#endif
#include <float.h>
@ -728,6 +728,7 @@ cconv(tnode_t *tn)
/* lvalue to rvalue */
if (tn->tn_lvalue) {
tp = expr_dup_type(tn->tn_type);
/* FIXME: even rvalues can be const/volatile, see msg_101 */
tp->t_const = tp->t_volatile = false;
tn = new_tnode(LOAD, tp, tn, NULL);
}