diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-07-30 08:30:32 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2008-07-30 08:30:32 +0000 |
commit | 6715192c06501e2bc1ee1a2670697dbe5d0efd41 (patch) | |
tree | 9f9fa0bd313bb28619e5203904c17f871a84a669 /gcc/c-common.h | |
parent | 473e10621f06ef6cfd82f3875224c4b82c2eb7cf (diff) | |
download | gcc-6715192c06501e2bc1ee1a2670697dbe5d0efd41.zip gcc-6715192c06501e2bc1ee1a2670697dbe5d0efd41.tar.gz gcc-6715192c06501e2bc1ee1a2670697dbe5d0efd41.tar.bz2 |
re PR c/34389 (-Wconversion produces wrong warning)
2008-07-30 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 34389
* c-typeck.c (build_binary_op): Encapsulate code into...
* c-common.c (shorten_binary_op): ...this new function.
(conversion_warning): Use the new function. Handle non-negative
constant in bitwise-and.
* c-common.h (shorten_binary_op): Declare.
cp/
* typeck.c (build_binary_op): Encapsulate code into
shorten_binary_op.
testsuite/
* gcc.dg/Wconversion-pr34389.c: New.
* g++.dg/warn/Wconversion-pr34389.C: New.
From-SVN: r138296
Diffstat (limited to 'gcc/c-common.h')
-rw-r--r-- | gcc/c-common.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/c-common.h b/gcc/c-common.h index 1ff5d66..f600751 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -743,6 +743,9 @@ extern bool same_scalar_type_ignoring_signedness (tree, tree); #define c_sizeof(T) c_sizeof_or_alignof_type (T, true, 1) #define c_alignof(T) c_sizeof_or_alignof_type (T, false, 1) +/* Subroutine of build_binary_op, used for certain operations. */ +extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise); + /* Subroutine of build_binary_op, used for comparison operations. See if the operands have both been converted from subword integer types and, if so, perhaps change them both back to their original type. */ |