diff options
author | Ian Lance Taylor <iant@google.com> | 2012-01-14 00:22:14 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-14 00:22:14 +0000 |
commit | 12448f77a57be1954b4f15455b06de9012e88390 (patch) | |
tree | 65cee32b0b18592f5aa5a416fb63c7ceeca865bc /gcc/cp/call.c | |
parent | 738134ef335a67def3b324823e24d2932d1baf06 (diff) | |
download | gcc-12448f77a57be1954b4f15455b06de9012e88390.zip gcc-12448f77a57be1954b4f15455b06de9012e88390.tar.gz gcc-12448f77a57be1954b4f15455b06de9012e88390.tar.bz2 |
re PR c++/50012 (C++ front end misses -Wsign-compare warnings when extraneous parentheses are present)
gcc/:
PR c++/50012
* tree.h (TYPE_QUALS): Add cast to int.
(TYPE_QUALS_NO_ADDR_SPACE): Likewise.
gcc/cp:
PR c++/50012
* typeck.c (enum_cast_to_int): New static function.
(cp_build_binary_op): When handling warn_sign_compare, don't test
for TREE_NO_WARNING. Do call enum_cast_to_int.
* call.c (avoid_sign_compare_warnings): Remove static function.
(build_new_op_1): Don't call avoid_sign_compare_warnings.
gcc/testsuite/:
PR c++/50012
* g++.dg/warn/Wsign-compare-4.C: New.
From-SVN: r183178
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index f7cfbd0..aa70749 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1,7 +1,7 @@ /* Functions related to invoking methods and overloaded functions. Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011 + 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) and modified by Brendan Kehoe (brendan@cygnus.com). @@ -4880,32 +4880,10 @@ add_candidates (tree fns, tree first_arg, const VEC(tree,gc) *args, } } -/* Even unsigned enum types promote to signed int. We don't want to - issue -Wsign-compare warnings for this case. Here ORIG_ARG is the - original argument and ARG is the argument after any conversions - have been applied. We set TREE_NO_WARNING if we have added a cast - from an unsigned enum type to a signed integer type. */ - -static void -avoid_sign_compare_warnings (tree orig_arg, tree arg) -{ - if (orig_arg != NULL_TREE - && arg != NULL_TREE - && orig_arg != arg - && TREE_CODE (TREE_TYPE (orig_arg)) == ENUMERAL_TYPE - && TYPE_UNSIGNED (TREE_TYPE (orig_arg)) - && INTEGRAL_TYPE_P (TREE_TYPE (arg)) - && !TYPE_UNSIGNED (TREE_TYPE (arg))) - TREE_NO_WARNING (arg) = 1; -} - static tree build_new_op_1 (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3, tree *overload, tsubst_flags_t complain) { - tree orig_arg1 = arg1; - tree orig_arg2 = arg2; - tree orig_arg3 = arg3; struct z_candidate *candidates = 0, *cand; VEC(tree,gc) *arglist; tree fnname; @@ -5200,10 +5178,6 @@ build_new_op_1 (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3, return result; builtin: - avoid_sign_compare_warnings (orig_arg1, arg1); - avoid_sign_compare_warnings (orig_arg2, arg2); - avoid_sign_compare_warnings (orig_arg3, arg3); - switch (code) { case MODIFY_EXPR: |