aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-12-20 19:46:12 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2008-12-20 19:46:12 +0100
commitfb3e178a78e0cfef9146dc17beb69ae53ed64616 (patch)
treea561d1d4957ce2ac0cd8556dd57969d83b2278bd /gcc/c-common.c
parent3ce1b2de2504c2cb2918c0e0c851eb15a873d7c4 (diff)
downloadgcc-fb3e178a78e0cfef9146dc17beb69ae53ed64616.zip
gcc-fb3e178a78e0cfef9146dc17beb69ae53ed64616.tar.gz
gcc-fb3e178a78e0cfef9146dc17beb69ae53ed64616.tar.bz2
re PR c++/36921 (warning "comparison does not have mathematical meaning" is not correct for overloaded operators that do not return boolean)
PR c++/36921 * c-common.c (warn_about_parentheses): Remove ARG_UNUSED from arg_left. Don't warn about X<=Y<=Z if comparison's type isn't integral. * g++.dg/warn/pr36921.C: New. Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org> From-SVN: r142849
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index e83b58e..d08a25b 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -8059,7 +8059,7 @@ warn_array_subscript_with_type_char (tree index)
void
warn_about_parentheses (enum tree_code code,
- enum tree_code code_left, tree ARG_UNUSED (arg_left),
+ enum tree_code code_left, tree arg_left,
enum tree_code code_right, tree arg_right)
{
if (!warn_parentheses)
@@ -8169,9 +8169,11 @@ warn_about_parentheses (enum tree_code code,
default:
if (TREE_CODE_CLASS (code) == tcc_comparison
&& ((TREE_CODE_CLASS (code_left) == tcc_comparison
- && code_left != NE_EXPR && code_left != EQ_EXPR)
+ && code_left != NE_EXPR && code_left != EQ_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (arg_left)))
|| (TREE_CODE_CLASS (code_right) == tcc_comparison
- && code_right != NE_EXPR && code_right != EQ_EXPR)))
+ && code_right != NE_EXPR && code_right != EQ_EXPR
+ && INTEGRAL_TYPE_P (TREE_TYPE (arg_right)))))
warning (OPT_Wparentheses, "comparisons like %<X<=Y<=Z%> do not "
"have their mathematical meaning");
return;