Module Name: src
Committed By: rillig
Date: Wed May 18 20:10:11 UTC 2022
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_160.c msg_160.exp
src/usr.bin/xlint/lint1: tree.c
Log Message:
lint: do not warn about '==' on the right-hand side of ','
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/msg_160.c
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/xlint/lint1/msg_160.exp
cvs rdiff -u -r1.440 -r1.441 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_160.c
diff -u src/tests/usr.bin/xlint/lint1/msg_160.c:1.7 src/tests/usr.bin/xlint/lint1/msg_160.c:1.8
--- src/tests/usr.bin/xlint/lint1/msg_160.c:1.7 Wed May 18 19:25:12 2022
+++ src/tests/usr.bin/xlint/lint1/msg_160.c Wed May 18 20:10:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_160.c,v 1.7 2022/05/18 19:25:12 rillig Exp $ */
+/* $NetBSD: msg_160.c,v 1.8 2022/05/18 20:10:11 rillig Exp $ */
# 3 "msg_160.c"
// Test for message: operator '==' found where '=' was expected [160]
@@ -68,8 +68,6 @@ assignment_in_comma_expression(int len)
* comma is a preparation, most often an assignment, and the
* right-hand operand of the comma is the actual condition.
*/
- /* FIXME: The following code is totally fine. */
- /* expect+1: warning: operator '==' found where '=' was expected [160] */
if (len = 3 * len + 1, len == 0)
return;
@@ -86,8 +84,6 @@ assignment_in_comma_expression(int len)
* In this case the parentheses are redundant, it's quite possible
* that they come from a macro expansion though.
*/
- /* FIXME: The following code is totally fine. */
- /* expect+1: warning: operator '==' found where '=' was expected [160] */
if ((len = 3 * len + 1, len == 0))
return;
@@ -97,8 +93,6 @@ assignment_in_comma_expression(int len)
* parentheses must therefore not be interpreted as changing the
* intention from a condition to an assignment.
*/
- /* FIXME: The following code is totally fine. */
- /* expect+1: warning: operator '==' found where '=' was expected [160] */
if ((len = 3 * len + 1, len == 0) && len < 2)
return;
}
Index: src/tests/usr.bin/xlint/lint1/msg_160.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_160.exp:1.6 src/tests/usr.bin/xlint/lint1/msg_160.exp:1.7
--- src/tests/usr.bin/xlint/lint1/msg_160.exp:1.6 Wed May 18 19:25:12 2022
+++ src/tests/usr.bin/xlint/lint1/msg_160.exp Wed May 18 20:10:11 2022
@@ -1,5 +1,2 @@
msg_160.c(30): warning: operator '==' found where '=' was expected [160]
msg_160.c(43): warning: operator '==' found where '=' was expected [160]
-msg_160.c(73): warning: operator '==' found where '=' was expected [160]
-msg_160.c(91): warning: operator '==' found where '=' was expected [160]
-msg_160.c(102): warning: operator '==' found where '=' was expected [160]
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.440 src/usr.bin/xlint/lint1/tree.c:1.441
--- src/usr.bin/xlint/lint1/tree.c:1.440 Wed May 18 20:01:21 2022
+++ src/usr.bin/xlint/lint1/tree.c Wed May 18 20:10:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.440 2022/05/18 20:01:21 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.441 2022/05/18 20:10:11 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.440 2022/05/18 20:01:21 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.441 2022/05/18 20:10:11 rillig Exp $");
#endif
#include <float.h>
@@ -4274,7 +4274,7 @@ check_expr_misc(const tnode_t *tn, bool
check_expr_misc(rn, cvctx, ccond, eq, false, false, szof);
break;
case COMMA:
- check_expr_misc(rn, vctx, cond, eq, false, false, szof);
+ check_expr_misc(rn, vctx, cond, false, false, false, szof);
break;
default:
if (mp->m_binary)