From 0d02885b732ad02a62cd2f8c001818867dfc188b Mon Sep 17 00:00:00 2001 From: Chad Loder Date: Mon, 28 Nov 2005 01:04:19 +0000 Subject: Do not complain about promotion of a constant (e.g. from int literal to a quad argument) as long as the constant is within the range of the type being promoted to. --- usr.bin/xlint/lint1/tree.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'usr.bin/xlint/lint1/tree.c') diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index e0848e86f14..15b983b7543 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.11 2005/11/23 00:12:13 cloder Exp $ */ +/* $OpenBSD: tree.c,v 1.12 2005/11/28 01:04:18 cloder Exp $ */ /* $NetBSD: tree.c,v 1.12 1995/10/02 17:37:57 jpo Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: tree.c,v 1.11 2005/11/23 00:12:13 cloder Exp $"; +static char rcsid[] = "$OpenBSD: tree.c,v 1.12 2005/11/28 01:04:18 cloder Exp $"; #endif #include @@ -1684,9 +1684,14 @@ ptconv(int arg, tspec_t nt, tspec_t ot, type_t *tp, tnode_t *tn) if (isftyp(nt) != isftyp(ot) || psize(nt) != psize(ot)) { /* representation and/or width change */ - if (styp(nt) != SHORT || !isityp(ot) || psize(ot) > psize(INT)) - /* conversion to '%s' due to prototype, arg #%d */ - warning(259, tyname(tp), arg); + if (styp(nt) != SHORT || !isityp(ot) || psize(ot) > psize(INT)) { + if (ptn->tn_op == CON) { + /* ok. promote() warns if constant out of range */ + } else { + /* conversion to '%s' due to prototype, arg #%d */ + warning(259, tyname(tp), arg); + } + } } else if (hflag) { /* * they differ in sign or base type (char, short, int, -- cgit v1.2.3