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]

[C++ PATCH]: more code cleaning up


Hi,
under the obvious rule I installed the attached patch
which makes use of the cp_error routines rather than TYPE_NAME_STRING.

built & tested on i686-pc-linux-gnu

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-08-08  Nathan Sidwell  <nathan@codesourcery.com>

	* decl.c (member_function_or_else): Use cp_error ... %T.
	(grokdeclarator): Likewise.
	(start_method): Likewise.
	* friend.c (make_friend_class): Use cp_pedwarn ... %T.

Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.667
diff -c -3 -p -r1.667 decl.c
*** decl.c	2000/08/07 07:13:13	1.667
--- decl.c	2000/08/08 15:53:14
*************** member_function_or_else (ctype, cur_type
*** 8697,8707 ****
    if (ctype && ctype != cur_type)
      {
        if (flags == DTOR_FLAG)
! 	error ("destructor for alien class `%s' cannot be a member",
! 	       TYPE_NAME_STRING (ctype));
        else
! 	error ("constructor for alien class `%s' cannot be a member",
! 	       TYPE_NAME_STRING (ctype));
        return 0;
      }
    return 1;
--- 8697,8707 ----
    if (ctype && ctype != cur_type)
      {
        if (flags == DTOR_FLAG)
! 	cp_error ("destructor for alien class `%T' cannot be a member",
! 	          ctype);
        else
! 	cp_error ("constructor for alien class `%T' cannot be a member",
! 	          ctype);
        return 0;
      }
    return 1;
*************** grokdeclarator (declarator, declspecs, d
*** 11220,11227 ****
  	      if (current_class_type)
  		make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type));
  	      else
! 		error ("trying to make class `%s' a friend of global scope",
! 		       TYPE_NAME_STRING (type));
  	      type = void_type_node;
  	    }
  	}
--- 11220,11227 ----
  	      if (current_class_type)
  		make_friend_class (current_class_type, TYPE_MAIN_VARIANT (type));
  	      else
! 		cp_error ("trying to make class `%T' a friend of global scope",
! 		          type);
  	      type = void_type_node;
  	    }
  	}
*************** start_method (declspecs, declarator, att
*** 14582,14589 ****
  	{
  	  if (DECL_CONTEXT (fndecl)
  	      && TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL)
! 	    cp_error ("`%D' is already defined in class %s", fndecl,
! 			     TYPE_NAME_STRING (DECL_CONTEXT (fndecl)));
  	}
        return void_type_node;
      }
--- 14582,14589 ----
  	{
  	  if (DECL_CONTEXT (fndecl)
  	      && TREE_CODE( DECL_CONTEXT (fndecl)) != NAMESPACE_DECL)
! 	    cp_error ("`%D' is already defined in class `%T'", fndecl,
! 	              DECL_CONTEXT (fndecl));
  	}
        return void_type_node;
      }
Index: cp/friend.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/friend.c,v
retrieving revision 1.59
diff -c -3 -p -r1.59 friend.c
*** friend.c	2000/05/31 19:27:12	1.59
--- friend.c	2000/08/08 15:53:15
*************** make_friend_class (type, friend_type)
*** 217,224 ****
      is_template_friend = 1;
    else if (same_type_p (type, friend_type))
      {
!       pedwarn ("class `%s' is implicitly friends with itself",
! 	       TYPE_NAME_STRING (type));
        return;
      }
    else
--- 217,224 ----
      is_template_friend = 1;
    else if (same_type_p (type, friend_type))
      {
!       cp_pedwarn ("class `%T' is implicitly friends with itself",
! 	          type);
        return;
      }
    else

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