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: fix bug in "precedence confusion p...



details:   https://anonhg.NetBSD.org/src/rev/b80b9ee4ad85
branches:  trunk
changeset: 958443:b80b9ee4ad85
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jan 04 23:50:46 2021 +0000

description:
lint: fix bug in "precedence confusion possible [169]"

diffstat:

 tests/usr.bin/xlint/lint1/msg_169.exp |   1 +
 usr.bin/xlint/lint1/tree.c            |  15 +++------------
 2 files changed, 4 insertions(+), 12 deletions(-)

diffs (44 lines):

diff -r 4202da1f8e67 -r b80b9ee4ad85 tests/usr.bin/xlint/lint1/msg_169.exp
--- a/tests/usr.bin/xlint/lint1/msg_169.exp     Mon Jan 04 23:47:26 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_169.exp     Mon Jan 04 23:50:46 2021 +0000
@@ -23,3 +23,4 @@
 msg_169.c(127): warning: precedence confusion possible: parenthesize! [169]
 msg_169.c(131): warning: precedence confusion possible: parenthesize! [169]
 msg_169.c(161): warning: precedence confusion possible: parenthesize! [169]
+msg_169.c(162): warning: precedence confusion possible: parenthesize! [169]
diff -r 4202da1f8e67 -r b80b9ee4ad85 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Mon Jan 04 23:47:26 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Mon Jan 04 23:50:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.131 2021/01/04 23:47:26 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.132 2021/01/04 23:50:46 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.131 2021/01/04 23:47:26 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.132 2021/01/04 23:50:46 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -4008,16 +4008,7 @@
 
        if (mp->m_binary) {
                rparn = 0;
-               /*
-                * FIXME: There is a typo "tn->tn_op == CVT", which should
-                * rather be "rn->tn_op".  Since tn must be a binary operator,
-                * it can never be CVT, so the loop is never taken.
-                *
-                * Since the loop is never taken, if the right-hand operand
-                * is CVT, it is not followed to the actually interesting
-                * operator.
-                */
-               for (rn = tn->tn_right; tn->tn_op == CVT; rn = rn->tn_left)
+               for (rn = tn->tn_right; rn->tn_op == CVT; rn = rn->tn_left)
                        rparn |= rn->tn_parenthesized;
                rparn |= rn->tn_parenthesized;
                rop = rn->tn_op;



Home | Main Index | Thread Index | Old Index