diff options
| author | rillig <rillig@NetBSD.org> | 2023-07-08 15:26:25 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2023-07-08 15:26:25 +0000 |
| commit | 65989024f874330227db7d9793fa78cab7c0ee2f (patch) | |
| tree | 74bc338956dbc13d05596e6fdabb684576902ce9 /usr.bin | |
| parent | 06c86f587bc97ca18607602ed3345db07a0dacd8 (diff) | |
lint: do not use portable type sizes in integer constraints
This reverts the change from tree.c 1.547 from 2023-07-03. Back then, I
didn't know that the actual value from a type's 'portable size in bits'
was not supposed to be used.
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/xlint/lint1/tree.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c index 5bda4bf4e62..9da4e6c1e9f 100644 --- a/usr.bin/xlint/lint1/tree.c +++ b/usr.bin/xlint/lint1/tree.c @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.552 2023/07/08 12:45:43 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.553 2023/07/08 15:26:25 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.552 2023/07/08 12:45:43 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.553 2023/07/08 15:26:25 rillig Exp $"); #endif #include <float.h> @@ -95,9 +95,7 @@ width_in_bits(const type_t *tp) lint_assert(is_integer(tp->t_tspec)); return tp->t_bitfield ? tp->t_bit_field_width - // FIXME: The rank of a type is only intended as a relative size, - // its value is not to be taken literally. - : type_properties(tp->t_tspec)->tt_rank; + : size_in_bits(tp->t_tspec); } static int @@ -3450,8 +3448,9 @@ convert_integer_from_integer(op_t op, int arg, tspec_t nt, tspec_t ot, (portable_rank_cmp(ot, LONG) >= 0 || aflag > 1) && // XXX: The portable_rank_cmp above aims at portable mode, // independent of the current platform, while can_represent acts - // on the actual types from the current platform. This mix is - // inconsistent. + // on the actual type sizes from the current platform. This mix + // is inconsistent, but anything else would make the exact + // conditions too complicated to grasp. !can_represent(tp, tn)) { if (op == FARG) { /* conversion from '%s' to '%s' may lose ... */ |
