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 wrong warning about 'unsigned ...
details: https://anonhg.NetBSD.org/src/rev/b60426486035
branches: trunk
changeset: 1022948:b60426486035
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Aug 15 13:08:19 2021 +0000
description:
lint: fix wrong warning about 'unsigned char >> constant'
diffstat:
tests/usr.bin/xlint/lint1/msg_117.c | 9 ++++++---
tests/usr.bin/xlint/lint1/msg_117.exp | 1 -
usr.bin/xlint/lint1/tree.c | 6 +++---
3 files changed, 9 insertions(+), 7 deletions(-)
diffs (57 lines):
diff -r a0d87b7680c5 -r b60426486035 tests/usr.bin/xlint/lint1/msg_117.c
--- a/tests/usr.bin/xlint/lint1/msg_117.c Sun Aug 15 13:02:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_117.c Sun Aug 15 13:08:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_117.c,v 1.6 2021/08/15 13:02:20 rillig Exp $ */
+/* $NetBSD: msg_117.c,v 1.7 2021/08/15 13:08:20 rillig Exp $ */
# 3 "msg_117.c"
// Test for message: bitwise '%s' on signed value possibly nonportable [117]
@@ -38,7 +38,10 @@
unsigned int
shr_unsigned_char(unsigned char uc)
{
- /* FIXME: This value cannot actually be negative. */
- /* expect+1: warning: bitwise '>>' on signed value possibly nonportable [117] */
+ /*
+ * Even though 'uc' is promoted to 'int', it cannot be negative.
+ * Before tree.c 1.335 from 2021-08-15, lint wrongly warned that
+ * 'uc >> 4' might be a bitwise '>>' on signed value.
+ */
return uc >> 4;
}
diff -r a0d87b7680c5 -r b60426486035 tests/usr.bin/xlint/lint1/msg_117.exp
--- a/tests/usr.bin/xlint/lint1/msg_117.exp Sun Aug 15 13:02:20 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_117.exp Sun Aug 15 13:08:19 2021 +0000
@@ -4,4 +4,3 @@
msg_117.c(29): warning: shift amount 4660 is greater than bit-size 32 of 'int' [122]
msg_117.c(35): warning: bitwise '>>' on signed value possibly nonportable [117]
msg_117.c(35): warning: negative shift [121]
-msg_117.c(43): warning: bitwise '>>' on signed value possibly nonportable [117]
diff -r a0d87b7680c5 -r b60426486035 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Sun Aug 15 13:02:20 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Sun Aug 15 13:08:19 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.334 2021/08/14 13:00:55 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.335 2021/08/15 13:08:19 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.334 2021/08/14 13:00:55 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.335 2021/08/15 13:08:19 rillig Exp $");
#endif
#include <float.h>
@@ -849,7 +849,7 @@
ort = before_conversion(rn)->tn_type->t_tspec;
/* operands have integer types (checked above) */
- if (pflag && !is_uinteger(lt)) {
+ if (pflag && !is_uinteger(olt)) {
/*
* The left operand is signed. This means that
* the operation is (possibly) nonportable.
Home |
Main Index |
Thread Index |
Old Index