lint: do not report usual arithmetic conversions for constants
This commit is contained in:
parent
573e4e5420
commit
872114d0db
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: queries.c,v 1.7 2023/01/08 18:21:00 rillig Exp $ */
|
||||
/* $NetBSD: queries.c,v 1.8 2023/01/08 18:37:12 rillig Exp $ */
|
||||
# 3 "queries.c"
|
||||
|
||||
/*
|
||||
|
@ -96,13 +96,22 @@ unsigned long long
|
|||
Q4(signed char *ptr, int i, unsigned long long ull)
|
||||
{
|
||||
|
||||
/* expect+1: usual arithmetic conversion for '&' from 'int' to 'unsigned int' [Q4] */
|
||||
/*
|
||||
* For constants, the usual arithmetic conversions are usually not
|
||||
* interesting, so omit them.
|
||||
*/
|
||||
u32 = u32 & 0xff;
|
||||
u32 &= 0xff;
|
||||
|
||||
/* expect+2: usual arithmetic conversion for '&' from 'int' to 'unsigned int' [Q4] */
|
||||
/* expect+1: implicit conversion changes sign from 'int' to 'unsigned int' [Q3] */
|
||||
u32 = u32 & s32;
|
||||
/*
|
||||
* XXX: C99 5.6.16.2 says that the usual arithmetic conversions
|
||||
* happen for compound assignments as well.
|
||||
*/
|
||||
u32 &= 0xff;
|
||||
/* expect+1: implicit conversion changes sign from 'int' to 'unsigned int' [Q3] */
|
||||
u32 &= s32;
|
||||
|
||||
/* expect+3: implicit conversion changes sign from 'unsigned char' to 'int' [Q3] */
|
||||
/* expect+2: usual arithmetic conversion for '&' from 'int' to 'unsigned int' [Q4] */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tree.c,v 1.488 2023/01/08 18:29:21 rillig Exp $ */
|
||||
/* $NetBSD: tree.c,v 1.489 2023/01/08 18:37:12 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.488 2023/01/08 18:29:21 rillig Exp $");
|
||||
__RCSID("$NetBSD: tree.c,v 1.489 2023/01/08 18:37:12 rillig Exp $");
|
||||
#endif
|
||||
|
||||
#include <float.h>
|
||||
|
@ -2223,9 +2223,11 @@ apply_usual_arithmetic_conversions(op_t op, tnode_t *tn, tspec_t t)
|
|||
{
|
||||
type_t *ntp = expr_dup_type(tn->tn_type);
|
||||
ntp->t_tspec = t;
|
||||
/* usual arithmetic conversion for '%s' from '%s' to '%s' */
|
||||
query_message(4, op_name(op),
|
||||
type_name(tn->tn_type), type_name(ntp));
|
||||
if (tn->tn_op != CON) {
|
||||
/* usual arithmetic conversion for '%s' from '%s' to '%s' */
|
||||
query_message(4, op_name(op),
|
||||
type_name(tn->tn_type), type_name(ntp));
|
||||
}
|
||||
return convert(op, 0, ntp, tn);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue