This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR 19190
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 Dec 2004 16:31:26 -0800
- Subject: C++ PATCH: PR 19190
- Reply-to: mark at codesourcery dot com
This patch fixes the problem that the C++ front end was now issuing
too many -Wunused warnings. Tested on x86_64-unknown-linux-gnu,
applied on the mainline.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2004-12-29 Mark Mitchell <mark@codesourcery.com>
PR c++/19190
* cvt.c (convert_to_void): Do not use STRIP_NOPs.
2004-12-29 Mark Mitchell <mark@codesourcery.com>
PR c++/19190
* g++.dg/warn/Wunused-10.C: New test.
Index: cp/cvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cvt.c,v
retrieving revision 1.176
diff -c -5 -p -r1.176 cvt.c
*** cp/cvt.c 23 Dec 2004 16:31:16 -0000 1.176
--- cp/cvt.c 30 Dec 2004 00:28:06 -0000
*************** convert_to_void (tree expr, const char *
*** 927,938 ****
generate implicit conversions under some
circumstances. (For example a block copy will be
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);
code = TREE_CODE (e);
class = TREE_CODE_CLASS (code);
if (class == tcc_comparison
|| class == tcc_unary
--- 927,941 ----
generate implicit conversions under some
circumstances. (For example a block copy will be
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. 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);
if (class == tcc_comparison
|| class == tcc_unary
Index: testsuite/g++.dg/warn/Wunused-10.C
===================================================================
RCS file: testsuite/g++.dg/warn/Wunused-10.C
diff -N testsuite/g++.dg/warn/Wunused-10.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/warn/Wunused-10.C 30 Dec 2004 00:28:06 -0000
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/19190
+ // { dg-options "-Wunused" }
+
+ struct breakme
+ {
+ void setAction( unsigned char a ) { act = a; }
+ unsigned int act:8;
+ };