summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcloder <cloder@openbsd.org>2005-12-09 04:28:28 +0000
committercloder <cloder@openbsd.org>2005-12-09 04:28:28 +0000
commitc19a6cd3cba46fa01617ba3815a209fe61732e80 (patch)
treef4aaf7d7724d65e32871ec4c3894a652cdcdec05
parentunused vars, my bad; (diff)
downloadwireguard-openbsd-c19a6cd3cba46fa01617ba3815a209fe61732e80.tar.xz
wireguard-openbsd-c19a6cd3cba46fa01617ba3815a209fe61732e80.zip
Do not warn about assignment in conditional context if the assignment
expression is itself wrapped in parentheses. We use this idiom in our tree to indicate that the programmer knows and accepts that an assignment is happening. Idea suggested by deraadt
-rw-r--r--usr.bin/xlint/lint1/tree.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c
index 218c31c6682..4df44bcb1ed 100644
--- a/usr.bin/xlint/lint1/tree.c
+++ b/usr.bin/xlint/lint1/tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tree.c,v 1.20 2005/12/09 03:33:11 cloder Exp $ */
+/* $OpenBSD: tree.c,v 1.21 2005/12/09 04:28:28 cloder Exp $ */
/* $NetBSD: tree.c,v 1.12 1995/10/02 17:37:57 jpo Exp $ */
/*
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: tree.c,v 1.20 2005/12/09 03:33:11 cloder Exp $";
+static char rcsid[] = "$OpenBSD: tree.c,v 1.21 2005/12/09 04:28:28 cloder Exp $";
#endif
#include <stdlib.h>
@@ -3297,7 +3297,7 @@ expr(tnode_t *tn, int vctx, int tctx)
chkmisc(tn, vctx, tctx, !tctx, 0, 0, 0);
if (tn->tn_op == ASSIGN) {
- if (hflag && tctx)
+ if (hflag && tctx && !tn->tn_parn)
/* assignment in conditional context */
warning(159);
} else if (tn->tn_op == CON) {