Module Name: src Committed By: rillig Date: Sun Jan 17 16:19:54 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_115.c msg_115.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: add test for incrementing const variable To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_115.c \ src/tests/usr.bin/xlint/lint1/msg_115.exp cvs rdiff -u -r1.175 -r1.176 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_115.c diff -u src/tests/usr.bin/xlint/lint1/msg_115.c:1.2 src/tests/usr.bin/xlint/lint1/msg_115.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_115.c:1.2 Fri Jan 8 21:25:03 2021 +++ src/tests/usr.bin/xlint/lint1/msg_115.c Sun Jan 17 16:19:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: msg_115.c,v 1.2 2021/01/08 21:25:03 rillig Exp $ */ +/* $NetBSD: msg_115.c,v 1.3 2021/01/17 16:19:54 rillig Exp $ */ # 3 "msg_115.c" // Test for message: %soperand of '%s' must be modifiable lvalue [115] @@ -13,4 +13,5 @@ example(const int *const_ptr) *const_ptr *= 1; *const_ptr /= 5; *const_ptr %= 9; + (*const_ptr)++; } Index: src/tests/usr.bin/xlint/lint1/msg_115.exp diff -u src/tests/usr.bin/xlint/lint1/msg_115.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_115.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_115.exp:1.2 Fri Jan 8 21:25:03 2021 +++ src/tests/usr.bin/xlint/lint1/msg_115.exp Sun Jan 17 16:19:54 2021 @@ -4,3 +4,4 @@ msg_115.c(12): warning: left operand of msg_115.c(13): warning: left operand of '*=' must be modifiable lvalue [115] msg_115.c(14): warning: left operand of '/=' must be modifiable lvalue [115] msg_115.c(15): warning: left operand of '%=' must be modifiable lvalue [115] +msg_115.c(16): warning: operand of 'x++' must be modifiable lvalue [115] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.175 src/usr.bin/xlint/lint1/tree.c:1.176 --- src/usr.bin/xlint/lint1/tree.c:1.175 Sun Jan 17 16:01:19 2021 +++ src/usr.bin/xlint/lint1/tree.c Sun Jan 17 16:19:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.175 2021/01/17 16:01:19 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.176 2021/01/17 16:19:54 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.175 2021/01/17 16:01:19 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.176 2021/01/17 16:19:54 rillig Exp $"); #endif #include <float.h> @@ -769,7 +769,7 @@ typeok_incdec(const mod_t *mp, const tno return false; } else if (tp->t_const) { if (!tflag) - /* %soperand of '%s' must be modifiable ... */ + /* %soperand of '%s' must be modifiable lvalue */ warning(115, "", mp->m_name); } return true;