aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2008-10-29 17:16:46 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2008-10-29 17:16:46 +0000
commitcdd6a337c0e1c4a07a0a45686dcaa159e51f451c (patch)
tree42ccc636ef21cba0db86051f05076ac6b24aa628 /gcc/c-common.c
parent20ded7a68b10f9c2d1aaa94e89df494bf0ce41a0 (diff)
downloadgcc-cdd6a337c0e1c4a07a0a45686dcaa159e51f451c.zip
gcc-cdd6a337c0e1c4a07a0a45686dcaa159e51f451c.tar.gz
gcc-cdd6a337c0e1c4a07a0a45686dcaa159e51f451c.tar.bz2
re PR middle-end/11492 (Bogus warning with -Wsign-compare)
2008-10-29 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 11492 * c-common.c (min_precision): Move to... * tree.c (tree_int_cst_min_precision): ... to here. Renamed. * tree.h (tree_int_cst_min_precision): Declare. * c-common.h (min_precision): Delete declaration. * fold-const.c (tree_binary_nonnegative_warnv_p): Handle multiplication of non-negative integer constants. * c-decl.c (check_bitfield_type_and_width): Rename min_precision to tree_int_cst_min_precision. (finish_enum): Likewise. cp/ * class.c (check_bitfield_decl): Rename min_precision to tree_int_cst_min_precision. * decl.c (finish_enum): Likewise. testsuite/ * gcc.dg/pr11492.c: New. * g++.dg/warn/pr11492.C: New. From-SVN: r141434
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c28
1 files changed, 0 insertions, 28 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 30acb7d..84dea11 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -2795,34 +2795,6 @@ c_register_builtin_type (tree type, const char* name)
registered_builtin_types = tree_cons (0, type, registered_builtin_types);
}
-
-
-/* Return the minimum number of bits needed to represent VALUE in a
- signed or unsigned type, UNSIGNEDP says which. */
-
-unsigned int
-min_precision (tree value, int unsignedp)
-{
- int log;
-
- /* If the value is negative, compute its negative minus 1. The latter
- adjustment is because the absolute value of the largest negative value
- is one larger than the largest positive value. This is equivalent to
- a bit-wise negation, so use that operation instead. */
-
- if (tree_int_cst_sgn (value) < 0)
- value = fold_build1 (BIT_NOT_EXPR, TREE_TYPE (value), value);
-
- /* Return the number of bits needed, taking into account the fact
- that we need one more bit for a signed than unsigned type. */
-
- if (integer_zerop (value))
- log = 0;
- else
- log = tree_floor_log2 (value);
-
- return log + 1 + !unsignedp;
-}
/* Print an error message for invalid operands to arith operation
CODE with TYPE0 for operand 0, and TYPE1 for operand 1.