]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/19190 (warning "value computed is not used" emitted too often)
authorMark Mitchell <mark@codesourcery.com>
Thu, 30 Dec 2004 00:31:00 +0000 (00:31 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 30 Dec 2004 00:31:00 +0000 (00:31 +0000)
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

gcc/cp/ChangeLog
gcc/cp/cvt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wunused-10.C [new file with mode: 0644]

index 9e96120e8083bdea8c3ffc0ae699eb1832741ab3..4be3133931d366495da3727d8d358ecfa3e5c190 100644 (file)
@@ -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
index b68cf0fd5b7b34ae54b8496e291b20d728a82ab3..a3ec5d45a73861761a2f17be6c2c807d0059e011 100644 (file)
@@ -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);
index f7208334c904ec7a32c844d600eba2ebdc668f0d..35125e4ee787813a8975e2e44f3981625d82a9ce 100644 (file)
@@ -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 (file)
index 0000000..d2d6a34
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/19190
+// { dg-options "-Wunused" }
+
+struct breakme 
+{ 
+  void setAction( unsigned char a ) { act = a; } 
+  unsigned int act:8; 
+};