aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2008-02-22 06:17:46 +0000
committerRalf Wildenhues <rwild@gcc.gnu.org>2008-02-22 06:17:46 +0000
commitae3115664af05ea853e101ea812148a12c5ed96b (patch)
tree3f5c89f2924defd243a7584af42364ce079bb2fd /gcc/cp
parent24219f12064acaa1575b66a9f498e8bc7b4894f9 (diff)
downloadgcc-ae3115664af05ea853e101ea812148a12c5ed96b.zip
gcc-ae3115664af05ea853e101ea812148a12c5ed96b.tar.gz
gcc-ae3115664af05ea853e101ea812148a12c5ed96b.tar.bz2
re PR c/19999 (-Wfloat-equal does not warn for complex numbers)
gcc/: PR c/19999 * c-typeck.c (build_binary_op): Warn about floating point comparisons if FLOAT_TYPE_P, not only for REAL_TYPE. gcc/cp/: * typeck.c (build_binary_op): Warn about floating point comparisons if FLOAT_TYPE_P, not only for REAL_TYPE. gcc/testsuite/: * gcc.dg/Wfloat-equal-1.c: New. * g++.dg/warn/Wfloat-equal-1.C: New. From-SVN: r132540
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 81a243a..b300db0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ PR c/19999
+ * typeck.c (build_binary_op): Warn about floating point
+ comparisons if FLOAT_TYPE_P, not only for REAL_TYPE.
+
2008-02-19 Jason Merrill <jason@redhat.com>
PR c++/34950
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9764ed3..eef6914 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3359,7 +3359,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
case EQ_EXPR:
case NE_EXPR:
- if (code0 == REAL_TYPE || code1 == REAL_TYPE)
+ if (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1))
warning (OPT_Wfloat_equal,
"comparing floating point with == or != is unsafe");
if ((TREE_CODE (orig_op0) == STRING_CST && !integer_zerop (op1))