lint: clean up redundant casts

This commit is contained in:
rillig 2023-07-03 07:19:57 +00:00
parent 4f51279e58
commit b3f3a1755e
3 changed files with 9 additions and 11 deletions

View File

@ -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))

View File

@ -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

View File

@ -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 lt, const tnode_t *rn, tspec_t rt)
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),