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,committed] Fix PR2019 (warning about duplicate friend)


Hi

This simple patch fixes a broken diagnostics about duplicate
friend declaration.  We don't have information about the location
of friend declarations here.  Friend functions are represent as a
TREE_LIST of FUNCTION_DECL that are original function declarations.  
(But duplicate_decls also manages to mess up these line numbers.  
That will be addressed in a separate patch.)

Tested on i686-pc-linux-gnu.  Committed to trunk as obvious.

--Kriang


2003-11-05  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>

	PR c++/2019
	* friend.c (add_friend): Don't display previous declaration in
	case of duplicate friend warning.


diff -cprN gcc-main-save/gcc/cp/friend.c gcc-main-new/gcc/cp/friend.c
*** gcc-main-save/gcc/cp/friend.c	Sat Aug 23 19:49:44 2003
--- gcc-main-new/gcc/cp/friend.c	Tue Nov  4 16:42:12 2003
*************** add_friend (tree type, tree decl, bool c
*** 158,169 ****
  	      if (decl == TREE_VALUE (friends))
  		{
  		  if (complain)
! 		    {
! 		      warning ("`%D' is already a friend of class `%T'",
! 			       decl, type);
! 		      cp_warning_at ("previous friend declaration of `%D'",
! 				     TREE_VALUE (friends));
! 		    }
  		  return;
  		}
  	    }
--- 158,165 ----
  	      if (decl == TREE_VALUE (friends))
  		{
  		  if (complain)
! 		    warning ("`%D' is already a friend of class `%T'",
! 			     decl, type);
  		  return;
  		}
  	    }


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