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]

Re: C++ PATCH for PR/18644


Mark Mitchell <mark@codesourcery.com> writes:

| Gabriel Dos Reis wrote:
| 
| > The compiler does not warn about that.  In a previous discussion, it was
| > my understanding that you preferred the compiler silently accept the
| > option.
| >    http://gcc.gnu.org/ml/gcc/2005-01/msg00118.html
| > Did I misunderstand?
| 
| No, I think I misunderstood you slightly.  Given the obscurity of this
| option, I think the patch you posted does exactly the right thing.

OK.  The version I sent applied cleanly to mainline, 4.0.x and 3.4.x.
Below is the version I applied to 3.3.x

-- Gaby

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.16114.2.1062
diff -p -r1.16114.2.1062 ChangeLog
*** ChangeLog	29 Mar 2005 00:31:32 -0000	1.16114.2.1062
--- ChangeLog	4 Apr 2005 07:15:47 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2005-04-04  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	PR c++/18644
+ 	* doc/invoke.texi (-Wsynth): Remove documentation.
+ 
  2005-03-28  James E Wilson  <wilson@specifixinc.com>
  
  	PR target/20286.
Index: cp/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.3076.2.281
diff -p -r1.3076.2.281 ChangeLog
*** cp/ChangeLog	18 Dec 2004 20:26:04 -0000	1.3076.2.281
--- cp/ChangeLog	4 Apr 2005 07:15:50 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2005-04-04  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	PR c++/18644
+ 	* call.c (build_new_op): Remove check for warn_synth.
+ 
  2004-12-18  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
  
  	PR c++/17456
Index: cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.341.2.43
diff -p -r1.341.2.43 call.c
*** cp/call.c	28 Jul 2004 02:17:21 -0000	1.341.2.43
--- cp/call.c	4 Apr 2005 07:15:52 -0000
*************** build_new_op (code, flags, arg1, arg2, a
*** 3762,3789 ****
      }
  
    if (TREE_CODE (cand->fn) == FUNCTION_DECL)
!     {
!       extern int warn_synth;
!       if (warn_synth
! 	  && fnname == ansi_assopname (NOP_EXPR)
! 	  && DECL_ARTIFICIAL (cand->fn)
! 	  && candidates->next
! 	  && ! candidates->next->next)
! 	{
! 	  warning ("using synthesized `%#D' for copy assignment",
! 		      cand->fn);
! 	  cp_warning_at ("  where cfront would use `%#D'",
! 			 cand == candidates
! 			 ? candidates->next->fn
! 			 : candidates->fn);
! 	}
! 
!       return build_over_call
! 	(cand,
! 	 TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
! 	 ? mem_arglist : arglist,
! 	 LOOKUP_NORMAL);
!     }
  
    /* Check for comparison of different enum types.  */
    switch (code)
--- 3762,3772 ----
      }
  
    if (TREE_CODE (cand->fn) == FUNCTION_DECL)
!     return build_over_call
!       (cand,
!        TREE_CODE (TREE_TYPE (cand->fn)) == METHOD_TYPE
!        ? mem_arglist : arglist,
!        LOOKUP_NORMAL);
  
    /* Check for comparison of different enum types.  */
    switch (code)
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.209.2.59
diff -p -r1.209.2.59 invoke.texi
*** doc/invoke.texi	26 Aug 2004 22:42:53 -0000	1.209.2.59
--- doc/invoke.texi	4 Apr 2005 07:15:53 -0000
*************** in the following sections.
*** 188,194 ****
  -Weffc++  -Wno-deprecated @gol
  -Wno-non-template-friend  -Wold-style-cast @gol
  -Woverloaded-virtual  -Wno-pmf-conversions @gol
! -Wsign-promo  -Wsynth}
  
  @item Objective-C Language Options
  @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
--- 188,194 ----
  -Weffc++  -Wno-deprecated @gol
  -Wno-non-template-friend  -Wold-style-cast @gol
  -Woverloaded-virtual  -Wno-pmf-conversions @gol
! -Wsign-promo}
  
  @item Objective-C Language Options
  @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
*************** Warn when overload resolution chooses a 
*** 1716,1744 ****
  enumeral type to a signed type, over a conversion to an unsigned type of
  the same size.  Previous versions of G++ would try to preserve
  unsignedness, but the standard mandates the current behavior.
- 
- @item -Wsynth @r{(C++ only)}
- @opindex Wsynth
- @cindex warning for synthesized methods
- @cindex synthesized methods, warning
- Warn when G++'s synthesis behavior does not match that of cfront.  For
- instance:
- 
- @smallexample
- struct A @{
-   operator int ();
-   A& operator = (int);
- @};
- 
- main ()
- @{
-   A a,b;
-   a = b;
- @}
- @end smallexample
- 
- In this example, G++ will synthesize a default @samp{A& operator =
- (const A&);}, while cfront will use the user-defined @samp{operator =}.
  @end table
  
  @node Objective-C Dialect Options
--- 1716,1721 ----
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v
retrieving revision 1.2261.2.398
diff -p -r1.2261.2.398 ChangeLog
*** testsuite/ChangeLog	23 Jan 2005 05:16:05 -0000	1.2261.2.398
--- testsuite/ChangeLog	4 Apr 2005 07:15:55 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2005-04-04  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	PR c++/18644
+ 	* g++.old-deja/g++.jason/warning9.C (struct A, main): Adjust.
+ 
  2005-01-22  Roger Sayle  <roger@eyesopen.com>
  
  	PR target/18402
Index: testsuite/g++.old-deja/g++.jason/warning9.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.jason/warning9.C,v
retrieving revision 1.2
diff -p -r1.2 warning9.C
*** testsuite/g++.old-deja/g++.jason/warning9.C	16 Dec 1998 21:38:37 -0000	1.2
--- testsuite/g++.old-deja/g++.jason/warning9.C	4 Apr 2005 07:15:56 -0000
***************
*** 2,13 ****
  
  struct A {
    operator int ();
!   A& operator= (int);		// WARNING - not used below
  };
  
  main()
  {
    A a, b;
  
!   a = b;			// WARNING - uses synthesized op=
  }
--- 2,13 ----
  
  struct A {
    operator int ();
!   A& operator= (int);
  };
  
  main()
  {
    A a, b;
  
!   a = b;
  }


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