aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo@gcc.gnu.org>2012-05-15 15:14:49 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-05-15 15:14:49 +0000
commita1bde5afcfe2e42ca2250fbf5676bdf5f30d05f6 (patch)
tree64ee7c2534fe46beab3731586d7d305cfcd1afc8 /gcc
parent7d67c380fab04773732b6b0494cf8ab22cc2d126 (diff)
downloadgcc-a1bde5afcfe2e42ca2250fbf5676bdf5f30d05f6.zip
gcc-a1bde5afcfe2e42ca2250fbf5676bdf5f30d05f6.tar.gz
gcc-a1bde5afcfe2e42ca2250fbf5676bdf5f30d05f6.tar.bz2
re PR c++/11856 (unsigned warning in template)
/cp 2012-05-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/11586 * pt.c (tsubst_copy_and_build): Increase / decrease c_inhibit_evaluation_warnings around build_x_binary_op call. /c-family 2012-05-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/11586 * c-common.c (shorten_compare): Check c_inhibit_evaluation_warnings. /testsuite 2012-05-15 Paolo Carlini <paolo.carlini@oracle.com> PR c++/11586 * g++.dg/warn/Wtype-limits.C: Don't warn in templates. * g++.dg/warn/Wtype-limits-Wextra.C: Likewise. From-SVN: r187542
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog8
-rw-r--r--gcc/c-family/c-common.c4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c9
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Wtype-limits.C2
7 files changed, 31 insertions, 6 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 3575480..1de6250 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,7 +1,11 @@
+2012-05-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/11586
+ * c-common.c (shorten_compare): Check c_inhibit_evaluation_warnings.
+
2012-05-14 Bernd Schmidt <bernds@codesourcery.com>
- * c-family/c-common.c (DEF_ATTR_STRING): Define and undefine as
- necessary.
+ * c-common.c (DEF_ATTR_STRING): Define and undefine as necessary.
2012-05-14 Manuel López-Ibáñez <manu@gcc.gnu.org>
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index f32a94a..f745365 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -3754,7 +3754,8 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
type = c_common_unsigned_type (type);
}
- if (TREE_CODE (primop0) != INTEGER_CST)
+ if (TREE_CODE (primop0) != INTEGER_CST
+ && c_inhibit_evaluation_warnings == 0)
{
if (val == truthvalue_false_node)
warning_at (loc, OPT_Wtype_limits,
@@ -3834,6 +3835,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
warning. */
bool warn =
warn_type_limits && !in_system_header
+ && c_inhibit_evaluation_warnings == 0
&& !(TREE_CODE (primop0) == INTEGER_CST
&& !TREE_OVERFLOW (convert (c_common_signed_type (type),
primop0)))
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3555be4..f469e2e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/11586
+ * pt.c (tsubst_copy_and_build): Increase / decrease
+ c_inhibit_evaluation_warnings around build_x_binary_op call.
+
2012-05-12 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h (TYPE_PTRMEM_P): Rename to TYPE_PTRDATAMEM_P.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 051abb8..ec121ff 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13608,7 +13608,11 @@ tsubst_copy_and_build (tree t,
case MEMBER_REF:
case DOTSTAR_EXPR:
{
- tree r = build_x_binary_op
+ tree r;
+
+ ++c_inhibit_evaluation_warnings;
+
+ r = build_x_binary_op
(input_location, TREE_CODE (t),
RECUR (TREE_OPERAND (t, 0)),
(TREE_NO_WARNING (TREE_OPERAND (t, 0))
@@ -13622,6 +13626,9 @@ tsubst_copy_and_build (tree t,
complain);
if (EXPR_P (r) && TREE_NO_WARNING (t))
TREE_NO_WARNING (r) = TREE_NO_WARNING (t);
+
+ --c_inhibit_evaluation_warnings;
+
return r;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0c7e44a..9e72f3f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/11586
+ * g++.dg/warn/Wtype-limits.C: Don't warn in templates.
+ * g++.dg/warn/Wtype-limits-Wextra.C: Likewise.
+
2012-05-15 Olivier Hainque <hainque@adacore.com>
* g++.dg/eh/sighandle.C: New testcase.
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
index 9cbdbe5..f840f30 100644
--- a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
@@ -66,7 +66,7 @@ int test (int x)
template <typename Int, Int D>
void f(Int x) {
- assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
+ assert(0 <= x and x <= D);
}
int ff(void) {
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits.C b/gcc/testsuite/g++.dg/warn/Wtype-limits.C
index 814c2a8..a352e7b 100644
--- a/gcc/testsuite/g++.dg/warn/Wtype-limits.C
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits.C
@@ -66,7 +66,7 @@ int test (int x)
template <typename Int, Int D>
void f(Int x) {
- assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
+ assert(0 <= x and x <= D);
}
int ff(void) {