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++} remove unreachable code


In looking at 21799 I noticed this cleanup is possible. We never called type_unification_real with subr and allow_incomplete being the same value.

booted on i686-pc-linux-gnu, installed

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2005-07-07  Nathan Sidwell  <nathan@codesourcery.com>

	* pt.c (type_unification_real): Remove allow_incomplete argument.
	Remove unreachable code.
	(fn_type_unification): Adjust call to type_unification_real.
	(unify): Likewise.

Index: pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.1011
diff -c -3 -p -r1.1011 pt.c
*** pt.c	2 Jul 2005 10:54:56 -0000	1.1011
--- pt.c	7 Jul 2005 14:36:30 -0000
*************** static tree add_outermost_template_args 
*** 109,115 ****
  static bool check_instantiated_args (tree, tree, tsubst_flags_t);
  static int maybe_adjust_types_for_deduction (unification_kind_t, tree*, tree*);
  static int  type_unification_real (tree, tree, tree, tree,
! 				   int, unification_kind_t, int);
  static void note_template_header (int);
  static tree convert_nontype_argument_function (tree, tree);
  static tree convert_nontype_argument (tree, tree);
--- 109,115 ----
  static bool check_instantiated_args (tree, tree, tsubst_flags_t);
  static int maybe_adjust_types_for_deduction (unification_kind_t, tree*, tree*);
  static int  type_unification_real (tree, tree, tree, tree,
! 				   int, unification_kind_t);
  static void note_template_header (int);
  static tree convert_nontype_argument_function (tree, tree);
  static tree convert_nontype_argument (tree, tree);
*************** fn_type_unification (tree fn,
*** 9167,9173 ****
  
    if (return_type)
      {
-       /* We've been given a return type to match, prepend it.  */
        parms = tree_cons (NULL_TREE, TREE_TYPE (fntype), parms);
        args = tree_cons (NULL_TREE, return_type, args);
      }
--- 9167,9172 ----
*************** fn_type_unification (tree fn,
*** 9178,9184 ****
       event.  */
    result = type_unification_real (DECL_INNERMOST_TEMPLATE_PARMS (fn),
  				  targs, parms, args, /*subr=*/0,
! 				  strict, /*allow_incomplete*/1);
  
    if (result == 0)
      /* All is well so far.  Now, check:
--- 9177,9183 ----
       event.  */
    result = type_unification_real (DECL_INNERMOST_TEMPLATE_PARMS (fn),
  				  targs, parms, args, /*subr=*/0,
! 				  strict);
  
    if (result == 0)
      /* All is well so far.  Now, check:
*************** type_unification_real (tree tparms,
*** 9294,9301 ****
  		       tree xparms,
  		       tree xargs,
  		       int subr,
! 		       unification_kind_t strict,
! 		       int allow_incomplete)
  {
    tree parm, arg;
    int i;
--- 9293,9299 ----
  		       tree xparms,
  		       tree xargs,
  		       int subr,
! 		       unification_kind_t strict)
  {
    tree parm, arg;
    int i;
*************** type_unification_real (tree tparms,
*** 9426,9433 ****
  	      && !saw_undeduced++)
  	    goto again;
  
- 	  if (!allow_incomplete)
- 	    error ("incomplete type unification");
  	  return 2;
  	}
  
--- 9424,9429 ----
*************** unify (tree tparms, tree targs, tree par
*** 10253,10260 ****
  		 TREE_TYPE (arg), UNIFY_ALLOW_NONE))
  	return 1;
        return type_unification_real (tparms, targs, TYPE_ARG_TYPES (parm),
! 				    TYPE_ARG_TYPES (arg), 1,
! 				    DEDUCE_EXACT, 0);
  
      case OFFSET_TYPE:
        /* Unify a pointer to member with a pointer to member function, which
--- 10249,10255 ----
  		 TREE_TYPE (arg), UNIFY_ALLOW_NONE))
  	return 1;
        return type_unification_real (tparms, targs, TYPE_ARG_TYPES (parm),
! 				    TYPE_ARG_TYPES (arg), 1, DEDUCE_EXACT);
  
      case OFFSET_TYPE:
        /* Unify a pointer to member with a pointer to member function, which

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