diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2005-11-28 01:04:19 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2005-11-28 01:04:19 +0000 |
commit | 0d02885b732ad02a62cd2f8c001818867dfc188b (patch) | |
tree | 32d88e1f95db9ccaa05553c5ebb44aea8bad4995 /usr.bin/xlint/lint1/tree.c | |
parent | 72d774af55a8afb44a52da5953ee39137258e784 (diff) |
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.
Diffstat (limited to 'usr.bin/xlint/lint1/tree.c')
-rw-r--r-- | usr.bin/xlint/lint1/tree.c | 15 |
1 files changed, 10 insertions, 5 deletions
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 <stdlib.h> @@ -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, |