Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: do not warn about '==' on the righ...



details:   https://anonhg.NetBSD.org/src/rev/3ae77fea4535
branches:  trunk
changeset: 366213:3ae77fea4535
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed May 18 20:10:11 2022 +0000

description:
lint: do not warn about '==' on the right-hand side of ','

diffstat:

 tests/usr.bin/xlint/lint1/msg_160.c   |  8 +-------
 tests/usr.bin/xlint/lint1/msg_160.exp |  3 ---
 usr.bin/xlint/lint1/tree.c            |  6 +++---
 3 files changed, 4 insertions(+), 13 deletions(-)

diffs (72 lines):

diff -r 2b78646db646 -r 3ae77fea4535 tests/usr.bin/xlint/lint1/msg_160.c
--- a/tests/usr.bin/xlint/lint1/msg_160.c       Wed May 18 20:03:58 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_160.c       Wed May 18 20:10:11 2022 +0000
@@ -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 @@
         * 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 @@
         * 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 @@
         * 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;
 }
diff -r 2b78646db646 -r 3ae77fea4535 tests/usr.bin/xlint/lint1/msg_160.exp
--- a/tests/usr.bin/xlint/lint1/msg_160.exp     Wed May 18 20:03:58 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_160.exp     Wed May 18 20:10:11 2022 +0000
@@ -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]
diff -r 2b78646db646 -r 3ae77fea4535 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Wed May 18 20:03:58 2022 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Wed May 18 20:10:11 2022 +0000
@@ -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(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)



Home | Main Index | Thread Index | Old Index