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: clean up redundant casts



details:   https://anonhg.NetBSD.org/src/rev/008cd57dee12
branches:  trunk
changeset: 377244:008cd57dee12
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 03 07:19:57 2023 +0000

description:
lint: clean up redundant casts

diffstat:

 usr.bin/xlint/lint1/lex.c   |   6 +++---
 usr.bin/xlint/lint1/lint1.h |   4 ++--
 usr.bin/xlint/lint1/tree.c  |  10 ++++------
 3 files changed, 9 insertions(+), 11 deletions(-)

diffs (78 lines):

diff -r cc1241b608aa -r 008cd57dee12 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Mon Jul 03 07:03:19 2023 +0000
+++ b/usr.bin/xlint/lint1/lex.c Mon Jul 03 07:19:57 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.167 2023/07/03 07:03:19 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.168 2023/07/03 07:19:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.167 2023/07/03 07:03:19 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.168 2023/07/03 07:19:57 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -1117,7 +1117,7 @@ lex_comment(void)
                }
        }
        arg[l] = '\0';
-       a = l != 0 ? (int)atoi(arg) : -1;
+       a = l != 0 ? atoi(arg) : -1;
 
        /* skip whitespace after the argument */
        while (isspace(c))
diff -r cc1241b608aa -r 008cd57dee12 usr.bin/xlint/lint1/lint1.h
--- a/usr.bin/xlint/lint1/lint1.h       Mon Jul 03 07:03:19 2023 +0000
+++ b/usr.bin/xlint/lint1/lint1.h       Mon Jul 03 07:19:57 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.180 2023/07/03 07:03:19 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.181 2023/07/03 07:19:57 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -574,7 +574,7 @@ bit(unsigned i)
 static inline bool
 msb(int64_t si, tspec_t t)
 {
-       return (si & bit((unsigned int)size_in_bits(t) - 1)) != 0;
+       return (si & bit(size_in_bits(t) - 1)) != 0;
 }
 
 static inline uint64_t
diff -r cc1241b608aa -r 008cd57dee12 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Mon Jul 03 07:03:19 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Mon Jul 03 07:19:57 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.545 2023/07/03 07:03:19 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.546 2023/07/03 07:19:57 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.545 2023/07/03 07:03:19 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.546 2023/07/03 07:19:57 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2332,12 +2332,10 @@ typeok_shift(const type_t *ltp, tspec_t 
        if (!is_uinteger(rt) && rn->tn_val.u.integer < 0) {
                /* negative shift */
                warning(121);
-       } else if ((uint64_t)rn->tn_val.u.integer ==
-                  (uint64_t)size_in_bits(lt)) {
+       } else if ((uint64_t)rn->tn_val.u.integer == size_in_bits(lt)) {
                /* shift amount %u equals bit-size of '%s' */
                warning(267, (unsigned)rn->tn_val.u.integer, type_name(ltp));
-       } else if ((uint64_t)rn->tn_val.u.integer
-           > (uint64_t)size_in_bits(lt)) {
+       } else if ((uint64_t)rn->tn_val.u.integer > size_in_bits(lt)) {
                /* shift amount %llu is greater than bit-size %llu of '%s' */
                warning(122, (unsigned long long)rn->tn_val.u.integer,
                    (unsigned long long)size_in_bits(lt),



Home | Main Index | Thread Index | Old Index