aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-12-30 00:31:00 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-12-30 00:31:00 +0000
commitd9fa123367aeaf3cf316d4c0c3bcd8dea047dee8 (patch)
treed04e684098be16fada657ab84d0137889a239e9b
parentd98fd13429d8819de437e6a681aebea99e3edbfe (diff)
downloadgcc-d9fa123367aeaf3cf316d4c0c3bcd8dea047dee8.zip
gcc-d9fa123367aeaf3cf316d4c0c3bcd8dea047dee8.tar.gz
gcc-d9fa123367aeaf3cf316d4c0c3bcd8dea047dee8.tar.bz2
re PR c++/19190 (warning "value computed is not used" emitted too often)
PR c++/19190 * cvt.c (convert_to_void): Do not use STRIP_NOPs. PR c++/19190 * g++.dg/warn/Wunused-10.C: New test. From-SVN: r92721
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/cvt.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-10.C8
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9e96120..4be3133 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/19190
+ * cvt.c (convert_to_void): Do not use STRIP_NOPs.
+
2004-12-28 Richard Henderson <rth@redhat.com>
PR inline-asm/15740
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index b68cf0f..a3ec5d4 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -929,8 +929,11 @@ convert_to_void (tree expr, const char *implicit)
turned into a call to "__builtin_memcpy", with a
conversion of the return value to an appropriate
type.) So, to avoid false positives, we strip
- conversions. */
- STRIP_NOPS (e);
+ conversions. Do not use STRIP_NOPs because it will
+ not strip conversions to "void", as that is not a
+ mode-preserving conversion. */
+ while (TREE_CODE (e) == NOP_EXPR)
+ e = TREE_OPERAND (e, 0);
code = TREE_CODE (e);
class = TREE_CODE_CLASS (code);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f720833..35125e4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-12-29 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/19190
+ * g++.dg/warn/Wunused-10.C: New test.
+
2004-12-28 Richard Henderson <rth@redhat.com>
* objc.dg/stabs-1.m: Disable for alpha.
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-10.C b/gcc/testsuite/g++.dg/warn/Wunused-10.C
new file mode 100644
index 0000000..d2d6a34
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-10.C
@@ -0,0 +1,8 @@
+// PR c++/19190
+// { dg-options "-Wunused" }
+
+struct breakme
+{
+ void setAction( unsigned char a ) { act = a; }
+ unsigned int act:8;
+};