diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-12-09 04:28:29 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-12-09 04:28:29 +0000 |
commit | 06dd4507db83fc57adee7c1cc5f2020cc08b0717 (patch) | |
tree | ff601e490038fa9e7ccf34798ae186487ef967c2 /usr.bin/xlint | |
parent | 4353368af7920fdce4ba91287453d2a4424b534d (diff) |
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
Diffstat (limited to 'usr.bin/xlint')
-rw-r--r-- | usr.bin/xlint/lint1/tree.c | 6 |
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) { |