Module Name: src Committed By: rillig Date: Mon Jan 4 23:50:47 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_169.exp src/usr.bin/xlint/lint1: tree.c Log Message: lint: fix bug in "precedence confusion possible [169]" To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_169.exp cvs rdiff -u -r1.131 -r1.132 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_169.exp diff -u src/tests/usr.bin/xlint/lint1/msg_169.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_169.exp:1.4 --- src/tests/usr.bin/xlint/lint1/msg_169.exp:1.3 Mon Jan 4 23:47:27 2021 +++ src/tests/usr.bin/xlint/lint1/msg_169.exp Mon Jan 4 23:50:46 2021 @@ -23,3 +23,4 @@ msg_169.c(126): warning: precedence conf 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] Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.131 src/usr.bin/xlint/lint1/tree.c:1.132 --- src/usr.bin/xlint/lint1/tree.c:1.131 Mon Jan 4 23:47:26 2021 +++ src/usr.bin/xlint/lint1/tree.c Mon Jan 4 23:50:46 2021 @@ -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 @@ check_precedence_confusion(tnode_t *tn) 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;