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

This commit is contained in:
rillig 2022-05-18 20:10:11 +00:00
parent 44ead2179f
commit 0b6921c927
3 changed files with 4 additions and 13 deletions

View File

@ -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;
}

View File

@ -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]

View File

@ -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 vctx, bool cond,
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)