From 469326d25e513efafc68db0c2fcf9f04b55e0068 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 4 Jul 2021 17:16:09 +0000 Subject: [PATCH] lint: document where to fix missing const in lvalue-to-rvalue No functional change. --- tests/usr.bin/xlint/lint1/msg_101.c | 4 ++-- usr.bin/xlint/lint1/tree.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/usr.bin/xlint/lint1/msg_101.c b/tests/usr.bin/xlint/lint1/msg_101.c index a0b1eda9c214..afed74e48f5c 100644 --- a/tests/usr.bin/xlint/lint1/msg_101.c +++ b/tests/usr.bin/xlint/lint1/msg_101.c @@ -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); } diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index d63062a9d8c5..220253ae5308 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -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 #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 @@ -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); }