This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH: PR 19190


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; 
+ }; 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]