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] gcc-assert, files a-m


And here's the n..z set of changes.

booted & tested on i686-pc-linux-gnu.

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

	* name-lookup.c (pop_binding, pushdecl,
	set_identifier_type_value_with_scope, push_overloaded_decl,
	arg_assoc_type): Replace abort with gcc_assert or gcc_unreachable.
	* parser.c (cp_parser_diagnose_invalid_type_name,
	cp_parser_postfix_expression, cp_parser_unary_expression,
	cp_parser_check_declarator_template_para): Likewise.
	* pt.c (push_inline_template_parms_recursive,
	check_explicit_specialization, convert_nontype_argument,
	coerce_template_template_parms, uses_template_parms,
	instantiate_class_template, tsubst_decl, tsubst, tsubst_copy,
	tsubst_expr, instantiate_template,
	maybe_adjust_types_for_deduction, type_unification_real,
	resolve_overloaded_unification, template_decl_level,
	type_dependent_expression_p): Likewise.
	* search.c (lookup_base_r): Likewise.
	* semantics.c (finish_stmt_expr, simplify_aggr_init_expr): Likewise.
	* tree.c (lvalue_p_1, count_functions, cxx_printable_name,
	verify_stmt_tree_r, get_type_decl, stabilize_call): Likewise.
	* typeck.c (common_type, get_member_function_from_ptrfunc,
	build_binary_op, build_unary_op, expand_ptrmemfunc_cst): Likewise.
	* typeck2.c (cxx_incomplete_type_diagnostic,
	split_nonconstant_init_1, store_init_value,
	process_init_constructor): Likewise.
Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.84
diff -c -3 -p -r1.84 name-lookup.c
*** cp/name-lookup.c	27 Aug 2004 17:59:28 -0000	1.84
--- cp/name-lookup.c	30 Aug 2004 15:10:15 -0000
*************** pop_binding (tree id, tree decl)
*** 457,466 ****
       binding for this identifier.  Remove that binding.  */
    if (binding->value == decl)
      binding->value = NULL_TREE;
-   else if (binding->type == decl)
-     binding->type = NULL_TREE;
    else
!     abort ();
  
    if (!binding->value && !binding->type)
      {
--- 457,467 ----
       binding for this identifier.  Remove that binding.  */
    if (binding->value == decl)
      binding->value = NULL_TREE;
    else
!     {
!       gcc_assert (binding->type == decl);
!       binding->type = NULL_TREE;
!     }
  
    if (!binding->value && !binding->type)
      {
*************** pushdecl (tree x)
*** 745,754 ****
  	    }
  	  else if (TREE_CODE (t) == PARM_DECL)
  	    {
! 	      if (DECL_CONTEXT (t) == NULL_TREE)
! 		/* This is probably caused by too many errors, but calling
! 		   abort will say that if errors have occurred.  */
! 		abort ();
  
  	      /* Check for duplicate params.  */
  	      if (duplicate_decls (x, t))
--- 746,752 ----
  	    }
  	  else if (TREE_CODE (t) == PARM_DECL)
  	    {
! 	      gcc_assert (DECL_CONTEXT (t));
  
  	      /* Check for duplicate params.  */
  	      if (duplicate_decls (x, t))
*************** set_identifier_type_value_with_scope (tr
*** 1759,1773 ****
      {
        cxx_binding *binding =
  	binding_for_name (NAMESPACE_LEVEL (current_namespace), id);
!       if (decl)
! 	{
! 	  if (binding->value)
! 	    supplement_binding (binding, decl);
! 	  else
! 	    binding->value = decl;
! 	}
        else
! 	abort ();
        /* Store marker instead of real type.  */
        type = global_type_node;
      }
--- 1757,1768 ----
      {
        cxx_binding *binding =
  	binding_for_name (NAMESPACE_LEVEL (current_namespace), id);
!       gcc_assert (decl);
!       if (binding->value)
! 	supplement_binding (binding, decl);
        else
! 	binding->value = decl;
!       
        /* Store marker instead of real type.  */
        type = global_type_node;
      }
*************** push_overloaded_decl (tree decl, int fla
*** 2098,2104 ****
  	      }
  
  	  /* We should always find a previous binding in this case.  */
! 	  abort ();
  	}
  
        /* Install the new binding.  */
--- 2093,2099 ----
  	      }
  
  	  /* We should always find a previous binding in this case.  */
! 	  gcc_unreachable ();
  	}
  
        /* Install the new binding.  */
*************** arg_assoc_type (struct arg_lookup *k, tr
*** 4476,4486 ****
      case TYPENAME_TYPE:
        return false;
      case LANG_TYPE:
!       if (type == unknown_type_node)
! 	return false;
!       /* else fall through */
      default:
!       abort ();
      }
    return false;
  }
--- 4471,4480 ----
      case TYPENAME_TYPE:
        return false;
      case LANG_TYPE:
!       gcc_assert (type == unknown_type_node);
!       return false;
      default:
!       gcc_unreachable ();
      }
    return false;
  }
Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.240
diff -c -3 -p -r1.240 parser.c
*** cp/parser.c	27 Aug 2004 21:48:11 -0000	1.240
--- cp/parser.c	30 Aug 2004 15:10:49 -0000
*************** cp_parser_diagnose_invalid_type_name (cp
*** 2230,2236 ****
  	error ("`%E' in class `%T' does not name a type",
  	       id, parser->scope);
        else
! 	abort();
      }
  }
  
--- 2230,2236 ----
  	error ("`%E' in class `%T' does not name a type",
  	       id, parser->scope);
        else
! 	gcc_unreachable ();
      }
  }
  
*************** cp_parser_postfix_expression (cp_parser 
*** 3806,3812 ****
  	      = build_const_cast (type, expression);
  	    break;
  	  default:
! 	    abort ();
  	  }
        }
        break;
--- 3806,3812 ----
  	      = build_const_cast (type, expression);
  	    break;
  	  default:
! 	    gcc_unreachable ();
  	  }
        }
        break;
*************** cp_parser_postfix_expression (cp_parser 
*** 4177,4183 ****
      }
  
    /* We should never get here.  */
!   abort ();
    return error_mark_node;
  }
  
--- 4177,4183 ----
      }
  
    /* We should never get here.  */
!   gcc_unreachable ();
    return error_mark_node;
  }
  
*************** cp_parser_unary_expression (cp_parser *p
*** 4741,4747 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
  
        if (non_constant_p
--- 4741,4747 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
  
        if (non_constant_p
*************** cp_parser_check_declarator_template_para
*** 14460,14468 ****
        return true;
  
      default:
!       abort ();
!       return false;
      }
  }
  
  /* NUM_TEMPLATES were used in the current declaration.  If that is
--- 14460,14468 ----
        return true;
  
      default:
!       gcc_unreachable ();
      }
+   return false;
  }
  
  /* NUM_TEMPLATES were used in the current declaration.  If that is
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.917
diff -c -3 -p -r1.917 pt.c
*** cp/pt.c	27 Aug 2004 21:48:12 -0000	1.917
--- cp/pt.c	30 Aug 2004 15:11:16 -0000
*************** push_inline_template_parms_recursive (tr
*** 384,390 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
      }
  }
--- 384,390 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
      }
  }
*************** check_explicit_specialization (tree decl
*** 1759,1765 ****
        break;
  
      default:
!       abort ();
      }
  
    if (specialization || member_specialization)
--- 1759,1765 ----
        break;
  
      default:
!       gcc_unreachable ();
      }
  
    if (specialization || member_specialization)
*************** convert_nontype_argument (tree type, tre
*** 3597,3604 ****
  
      default:
        /* All non-type parameters must have one of these types.  */
!       abort ();
!       break;
      }
  
    return error_mark_node;
--- 3597,3603 ----
  
      default:
        /* All non-type parameters must have one of these types.  */
!       gcc_unreachable ();
      }
  
    return error_mark_node;
*************** coerce_template_template_parms (tree par
*** 3690,3696 ****
  	  break;
  	  
  	default:
! 	  abort ();
  	}
      }
    return 1;
--- 3689,3695 ----
  	  break;
  	  
  	default:
! 	  gcc_unreachable ();
  	}
      }
    return 1;
*************** uses_template_parms (tree t)
*** 4890,4899 ****
  	   || TREE_CODE_CLASS (TREE_CODE (t)) == 'c')
      dependent_p = (type_dependent_expression_p (t)
  		   || value_dependent_expression_p (t));
!   else if (t == error_mark_node)
!     dependent_p = false;
!   else 
!     abort ();
    processing_template_decl = saved_processing_template_decl;
  
    return dependent_p;
--- 4889,4900 ----
  	   || TREE_CODE_CLASS (TREE_CODE (t)) == 'c')
      dependent_p = (type_dependent_expression_p (t)
  		   || value_dependent_expression_p (t));
!   else
!     {
!       gcc_assert (t == error_mark_node);
!       dependent_p = false;
!     }
!   
    processing_template_decl = saved_processing_template_decl;
  
    return dependent_p;
*************** instantiate_class_template (tree type)
*** 5470,5485 ****
  
    pbinfo = TYPE_BINFO (pattern);
  
! #ifdef ENABLE_CHECKING
!   if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern))
!       && ! COMPLETE_TYPE_P (TYPE_CONTEXT (type))
!       && ! TYPE_BEING_DEFINED (TYPE_CONTEXT (type)))
!     /* We should never instantiate a nested class before its enclosing
!        class; we need to look up the nested class by name before we can
!        instantiate it, and that lookup should instantiate the enclosing
!        class.  */
!     abort ();
! #endif
  
    base_list = NULL_TREE;
    if (BINFO_N_BASE_BINFOS (pbinfo))
--- 5471,5483 ----
  
    pbinfo = TYPE_BINFO (pattern);
  
!   /* We should never instantiate a nested class before its enclosing
!      class; we need to look up the nested class by name before we can
!      instantiate it, and that lookup should instantiate the enclosing
!      class.  */
!   gcc_assert (!DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (pattern))
! 	      || COMPLETE_TYPE_P (TYPE_CONTEXT (type))
! 	      || TYPE_BEING_DEFINED (TYPE_CONTEXT (type)));
  
    base_list = NULL_TREE;
    if (BINFO_N_BASE_BINFOS (pbinfo))
*************** tsubst_decl (tree t, tree args, tree typ
*** 6535,6541 ****
        break;
  
      default:
!       abort ();
      } 
  
    /* Restore the file and line information.  */
--- 6533,6539 ----
        break;
  
      default:
!       gcc_unreachable ();
      } 
  
    /* Restore the file and line information.  */
*************** tsubst (tree t, tree args, tsubst_flags_
*** 6813,6821 ****
--- 6811,6821 ----
  	int idx;
  	int level;
  	int levels;
+ 	tree arg = NULL_TREE;
  
  	r = NULL_TREE;
  
+ 	gcc_assert (TREE_VEC_LENGTH (args) > 0);
  	if (TREE_CODE (t) == TEMPLATE_TYPE_PARM
  	    || TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM
  	    || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
*************** tsubst (tree t, tree args, tsubst_flags_
*** 6829,6885 ****
  	    level = TEMPLATE_PARM_LEVEL (t);
  	  }
  
! 	if (TREE_VEC_LENGTH (args) > 0)
! 	  {
! 	    tree arg = NULL_TREE;
  
! 	    levels = TMPL_ARGS_DEPTH (args);
! 	    if (level <= levels)
! 	      arg = TMPL_ARG (args, level, idx);
! 
! 	    if (arg == error_mark_node)
! 	      return error_mark_node;
! 	    else if (arg != NULL_TREE)
  	      {
! 		if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
! 		  {
! 		    gcc_assert (TYPE_P (arg));
! 		    return cp_build_qualified_type_real
! 		      (arg, cp_type_quals (arg) | cp_type_quals (t),
! 		       complain | tf_ignore_bad_quals);
! 		  }
! 		else if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
! 		  {
! 		    /* We are processing a type constructed from
! 		       a template template parameter.  */
! 		    tree argvec = tsubst (TYPE_TI_ARGS (t),
! 					  args, complain, in_decl);
! 		    if (argvec == error_mark_node)
! 		      return error_mark_node;
  			
! 		    /* We can get a TEMPLATE_TEMPLATE_PARM here when 
! 		       we are resolving nested-types in the signature of 
! 		       a member function templates.
! 		       Otherwise ARG is a TEMPLATE_DECL and is the real 
! 		       template to be instantiated.  */
! 		    if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
! 		      arg = TYPE_NAME (arg);
! 
! 		    r = lookup_template_class (arg, 
! 					       argvec, in_decl, 
! 					       DECL_CONTEXT (arg),
! 					       /*entering_scope=*/0,
! 	                                       complain);
! 		    return cp_build_qualified_type_real
! 		      (r, TYPE_QUALS (t), complain);
! 		  }
! 		else
! 		  /* TEMPLATE_TEMPLATE_PARM or TEMPLATE_PARM_INDEX.  */
! 		  return arg;
  	      }
  	  }
- 	else
- 	  abort ();
  
  	if (level == 1)
  	  /* This can happen during the attempted tsubst'ing in
--- 6829,6878 ----
  	    level = TEMPLATE_PARM_LEVEL (t);
  	  }
  
! 	levels = TMPL_ARGS_DEPTH (args);
! 	if (level <= levels)
! 	  arg = TMPL_ARG (args, level, idx);
  
! 	if (arg == error_mark_node)
! 	  return error_mark_node;
! 	else if (arg != NULL_TREE)
! 	  {
! 	    if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
  	      {
! 		gcc_assert (TYPE_P (arg));
! 		return cp_build_qualified_type_real
! 		  (arg, cp_type_quals (arg) | cp_type_quals (t),
! 		   complain | tf_ignore_bad_quals);
! 	      }
! 	    else if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM)
! 	      {
! 		/* We are processing a type constructed from a
! 		   template template parameter.  */
! 		tree argvec = tsubst (TYPE_TI_ARGS (t),
! 				      args, complain, in_decl);
! 		if (argvec == error_mark_node)
! 		  return error_mark_node;
  			
! 		/* We can get a TEMPLATE_TEMPLATE_PARM here when we
! 		   are resolving nested-types in the signature of a
! 		   member function templates.  Otherwise ARG is a
! 		   TEMPLATE_DECL and is the real template to be
! 		   instantiated.  */
! 		if (TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
! 		  arg = TYPE_NAME (arg);
! 		
! 		r = lookup_template_class (arg, 
! 					   argvec, in_decl, 
! 					   DECL_CONTEXT (arg),
! 					    /*entering_scope=*/0,
! 					   complain);
! 		return cp_build_qualified_type_real
! 		  (r, TYPE_QUALS (t), complain);
  	      }
+ 	    else
+ 	      /* TEMPLATE_TEMPLATE_PARM or TEMPLATE_PARM_INDEX.  */
+ 	      return arg;
  	  }
  
  	if (level == 1)
  	  /* This can happen during the attempted tsubst'ing in
*************** tsubst (tree t, tree args, tsubst_flags_
*** 6932,6938 ****
  	    break;
  	   
  	  default:
! 	    abort ();
  	  }
  
  	return r;
--- 6925,6931 ----
  	    break;
  	   
  	  default:
! 	    gcc_unreachable ();
  	  }
  
  	return r;
*************** tsubst (tree t, tree args, tsubst_flags_
*** 6975,6981 ****
        
      case TREE_BINFO:
        /* We should never be tsubsting a binfo.  */
!       abort ();
  
      case TREE_VEC:
        /* A vector of template arguments.  */
--- 6968,6974 ----
        
      case TREE_BINFO:
        /* We should never be tsubsting a binfo.  */
!       gcc_unreachable ();
  
      case TREE_VEC:
        /* A vector of template arguments.  */
*************** tsubst (tree t, tree args, tsubst_flags_
*** 7251,7257 ****
      case INDIRECT_REF:
      case ADDR_EXPR:
      case CALL_EXPR:
!       abort ();
  
      case ARRAY_REF:
        {
--- 7244,7250 ----
      case INDIRECT_REF:
      case ADDR_EXPR:
      case CALL_EXPR:
!       gcc_unreachable ();
  
      case ARRAY_REF:
        {
*************** tsubst_copy (tree t, tree args, tsubst_f
*** 7501,7507 ****
  	  /* We didn't find the name.  That should never happen; if
  	     name-lookup found it during preliminary parsing, we
  	     should find it again here during instantiation.  */
! 	abort ();
        }
        return t;
  
--- 7494,7500 ----
  	  /* We didn't find the name.  That should never happen; if
  	     name-lookup found it during preliminary parsing, we
  	     should find it again here during instantiation.  */
! 	gcc_unreachable ();
        }
        return t;
  
*************** tsubst_copy (tree t, tree args, tsubst_f
*** 7786,7792 ****
        /* We shouldn't have built any of these during initial template
  	 generation.  Instead, they should be built during instantiation
  	 in response to the saved STMT_IS_FULL_EXPR_P setting.  */
!       abort ();
  
      default:
        return t;
--- 7779,7785 ----
        /* We shouldn't have built any of these during initial template
  	 generation.  Instead, they should be built during instantiation
  	 in response to the saved STMT_IS_FULL_EXPR_P setting.  */
!       gcc_unreachable ();
  
      default:
        return t;
*************** tsubst_expr (tree t, tree args, tsubst_f
*** 8098,8107 ****
        return fold_offsetof (t);
  
      default:
!       if (!STATEMENT_CODE_P (TREE_CODE (t)))
! 	return tsubst_copy_and_build (t, args, complain, in_decl,
! 				      /*function_p=*/false);
!       abort ();
      }
  
    return NULL_TREE;
--- 8091,8100 ----
        return fold_offsetof (t);
  
      default:
!       gcc_assert (!STATEMENT_CODE_P (TREE_CODE (t)));
!       
!       return tsubst_copy_and_build (t, args, complain, in_decl,
! 				    /*function_p=*/false);
      }
  
    return NULL_TREE;
*************** instantiate_template (tree tmpl, tree ta
*** 8734,8740 ****
  	if (DECL_NAME (clone) == DECL_NAME (tmpl))
  	  return clone;
        /* We should always have found the clone by now.  */
!       abort ();
        return NULL_TREE;
      }
    
--- 8727,8733 ----
  	if (DECL_NAME (clone) == DECL_NAME (tmpl))
  	  return clone;
        /* We should always have found the clone by now.  */
!       gcc_unreachable ();
        return NULL_TREE;
      }
    
*************** maybe_adjust_types_for_deduction (unific
*** 8996,9002 ****
          }
        break;
      default:
!       abort ();
      }
  
    if (TREE_CODE (*parm) != REFERENCE_TYPE)
--- 8989,8995 ----
          }
        break;
      default:
!       gcc_unreachable ();
      }
  
    if (TREE_CODE (*parm) != REFERENCE_TYPE)
*************** type_unification_real (tree tparms, 
*** 9095,9101 ****
        break;
        
      default:
!       abort ();
      }
  
    if (xlen == 0)
--- 9088,9094 ----
        break;
        
      default:
!       gcc_unreachable ();
      }
  
    if (xlen == 0)
*************** resolve_overloaded_unification (tree tpa
*** 9283,9298 ****
  	    }
  	}
      }
!   else if (TREE_CODE (arg) == OVERLOAD
! 	   || TREE_CODE (arg) == FUNCTION_DECL)
      {
        for (; arg; arg = OVL_NEXT (arg))
  	good += try_one_overload (tparms, targs, tempargs, parm,
  				  TREE_TYPE (OVL_CURRENT (arg)),
  				  strict, sub_strict, addr_p);
      }
-   else
-     abort ();
  
    /* [temp.deduct.type] A template-argument can be deduced from a pointer
       to function or pointer to member function argument if the set of
--- 9276,9291 ----
  	    }
  	}
      }
!   else
      {
+       gcc_assert (TREE_CODE (arg) == OVERLOAD
+ 		  || TREE_CODE (arg) == FUNCTION_DECL);
+   
        for (; arg; arg = OVL_NEXT (arg))
  	good += try_one_overload (tparms, targs, tempargs, parm,
  				  TREE_TYPE (OVL_CURRENT (arg)),
  				  strict, sub_strict, addr_p);
      }
  
    /* [temp.deduct.type] A template-argument can be deduced from a pointer
       to function or pointer to member function argument if the set of
*************** template_decl_level (tree decl)
*** 9593,9601 ****
        return TEMPLATE_PARM_LEVEL (DECL_INITIAL (decl));
  
      default:
!       abort ();
!       return 0;
      }
  }
  
  /* Decide whether ARG can be unified with PARM, considering only the
--- 9586,9594 ----
        return TEMPLATE_PARM_LEVEL (DECL_INITIAL (decl));
  
      default:
!       gcc_unreachable ();
      }
+   return 0;
  }
  
  /* Decide whether ARG can be unified with PARM, considering only the
*************** type_dependent_expression_p (tree expres
*** 11959,11964 ****
--- 11952,11958 ----
        
        if (TREE_CODE (expression) == BASELINK)
  	expression = BASELINK_FUNCTIONS (expression);
+       
        if (TREE_CODE (expression) == TEMPLATE_ID_EXPR)
  	{
  	  if (any_dependent_template_arguments_p
*************** type_dependent_expression_p (tree expres
*** 11966,11982 ****
  	    return true;
  	  expression = TREE_OPERAND (expression, 0);
  	}
!       if (TREE_CODE (expression) == OVERLOAD)
  	{
! 	  while (expression)
! 	    {
! 	      if (type_dependent_expression_p (OVL_CURRENT (expression)))
! 		return true;
! 	      expression = OVL_NEXT (expression);
! 	    }
! 	  return false;
  	}
!       abort ();
      }
    
    return (dependent_type_p (TREE_TYPE (expression)));
--- 11960,11974 ----
  	    return true;
  	  expression = TREE_OPERAND (expression, 0);
  	}
!       gcc_assert (TREE_CODE (expression) == OVERLOAD);
!       
!       while (expression)
  	{
! 	  if (type_dependent_expression_p (OVL_CURRENT (expression)))
! 	    return true;
! 	  expression = OVL_NEXT (expression);
  	}
!       return false;
      }
    
    return (dependent_type_p (TREE_TYPE (expression)));
Index: cp/search.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/search.c,v
retrieving revision 1.315
diff -c -3 -p -r1.315 search.c
*** cp/search.c	27 Aug 2004 17:59:30 -0000	1.315
--- cp/search.c	30 Aug 2004 15:11:19 -0000
*************** lookup_base_r (tree binfo, tree base, ba
*** 161,167 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
      }
    return found;
--- 161,167 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
      }
    return found;
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.427
diff -c -3 -p -r1.427 semantics.c
*** cp/semantics.c	27 Aug 2004 17:59:32 -0000	1.427
--- cp/semantics.c	30 Aug 2004 15:11:24 -0000
*************** finish_stmt_expr (tree stmt_expr, bool h
*** 1563,1569 ****
  	      result_stmt_p = &TREE_OPERAND (t, 0);
  	      break;
  	    default:
! 	      abort ();
  	    }
  	}
        type = TREE_TYPE (EXPR_STMT_EXPR (result_stmt));
--- 1563,1569 ----
  	      result_stmt_p = &TREE_OPERAND (t, 0);
  	      break;
  	    default:
! 	      gcc_unreachable ();
  	    }
  	}
        type = TREE_TYPE (EXPR_STMT_EXPR (result_stmt));
*************** finish_stmt_expr (tree stmt_expr, bool h
*** 1601,1610 ****
  	     returning a value directly, give it the appropriate type.  */
  	  if (VOID_TYPE_P (TREE_TYPE (result)))
  	    TREE_TYPE (result) = type;
- 	  else if (same_type_p (TREE_TYPE (result), type))
- 	    ;
  	  else
! 	    abort ();
  	}
        else if (TREE_CODE (result) == STATEMENT_LIST)
  	/* We need to wrap a STATEMENT_LIST in a BIND_EXPR so it can have a
--- 1601,1608 ----
  	     returning a value directly, give it the appropriate type.  */
  	  if (VOID_TYPE_P (TREE_TYPE (result)))
  	    TREE_TYPE (result) = type;
  	  else
! 	    gcc_assert (same_type_p (TREE_TYPE (result), type));
  	}
        else if (TREE_CODE (result) == STATEMENT_LIST)
  	/* We need to wrap a STATEMENT_LIST in a BIND_EXPR so it can have a
*************** simplify_aggr_init_expr (tree *tp)
*** 2771,2782 ****
    else if (1)
      style = pcc;
  #endif
-   else if (TREE_ADDRESSABLE (type))
-     style = arg;
    else
!     /* We shouldn't build an AGGR_INIT_EXPR if we don't need any special
!        handling.  See build_cplus_new.  */
!     abort ();
  
    if (style == ctor || style == arg)
      {
--- 2769,2779 ----
    else if (1)
      style = pcc;
  #endif
    else
!     {
!       gcc_assert (TREE_ADDRESSABLE (type));
!       style = arg;
!     }
  
    if (style == ctor || style == arg)
      {
*************** simplify_aggr_init_expr (tree *tp)
*** 2793,2803 ****
  	{
  	  /* The return type might have different cv-quals from the slot.  */
  	  tree fntype = TREE_TYPE (TREE_TYPE (fn));
! #ifdef ENABLE_CHECKING
! 	  if (TREE_CODE (fntype) != FUNCTION_TYPE
! 	      && TREE_CODE (fntype) != METHOD_TYPE)
! 	    abort ();
! #endif
  	  addr = convert (build_pointer_type (TREE_TYPE (fntype)), addr);
  	}
  
--- 2790,2798 ----
  	{
  	  /* The return type might have different cv-quals from the slot.  */
  	  tree fntype = TREE_TYPE (TREE_TYPE (fn));
! 	  
! 	  gcc_assert (TREE_CODE (fntype) == FUNCTION_TYPE
! 		      || TREE_CODE (fntype) == METHOD_TYPE);
  	  addr = convert (build_pointer_type (TREE_TYPE (fntype)), addr);
  	}
  
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.408
diff -c -3 -p -r1.408 tree.c
*** cp/tree.c	28 Aug 2004 02:35:14 -0000	1.408
--- cp/tree.c	30 Aug 2004 15:11:29 -0000
*************** lvalue_p_1 (tree ref,
*** 126,132 ****
  
        /* A currently unresolved scope ref.  */
      case SCOPE_REF:
!       abort ();
      case MAX_EXPR:
      case MIN_EXPR:
        op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 0),
--- 126,132 ----
  
        /* A currently unresolved scope ref.  */
      case SCOPE_REF:
!       gcc_unreachable ();
      case MAX_EXPR:
      case MIN_EXPR:
        op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 0),
*************** int
*** 796,812 ****
  count_functions (tree t)
  {
    int i;
    if (TREE_CODE (t) == FUNCTION_DECL)
      return 1;
!   else if (TREE_CODE (t) == OVERLOAD)
!     {
!       for (i = 0; t; t = OVL_CHAIN (t))
! 	i++;
!       return i;
!     }
! 
!   abort ();
!   return 0;
  }
  
  int
--- 796,809 ----
  count_functions (tree t)
  {
    int i;
+   
    if (TREE_CODE (t) == FUNCTION_DECL)
      return 1;
!   gcc_assert (TREE_CODE (t) == OVERLOAD);
!   
!   for (i = 0; t; t = OVL_CHAIN (t))
!     i++;
!   return i;
  }
  
  int
*************** cxx_printable_name (tree decl, int v)
*** 915,922 ****
  	ring_counter += 1;
        if (ring_counter == PRINT_RING_SIZE)
  	ring_counter = 0;
!       if (decl_ring[ring_counter] == current_function_decl)
! 	abort ();
      }
  
    if (print_ring[ring_counter])
--- 912,918 ----
  	ring_counter += 1;
        if (ring_counter == PRINT_RING_SIZE)
  	ring_counter = 0;
!       gcc_assert (decl_ring[ring_counter] != current_function_decl);
      }
  
    if (print_ring[ring_counter])
*************** verify_stmt_tree_r (tree* tp,
*** 1016,1023 ****
  
    /* If this statement is already present in the hash table, then
       there is a circularity in the statement tree.  */
!   if (htab_find (*statements, t))
!     abort ();
  
    slot = htab_find_slot (*statements, t, INSERT);
    *slot = t;
--- 1012,1018 ----
  
    /* If this statement is already present in the hash table, then
       there is a circularity in the statement tree.  */
!   gcc_assert (!htab_find (*statements, t));
  
    slot = htab_find_slot (*statements, t, INSERT);
    *slot = t;
*************** get_type_decl (tree t)
*** 1371,1383 ****
      return t;
    if (TYPE_P (t))
      return TYPE_STUB_DECL (t);
!   if (t == error_mark_node)
!     return t;
! 
!   abort ();
! 
!   /* Stop compiler from complaining control reaches end of non-void function.  */
!   return 0;
  }
  
  /* Returns the namespace that contains DECL, whether directly or
--- 1366,1373 ----
      return t;
    if (TYPE_P (t))
      return TYPE_STUB_DECL (t);
!   gcc_assert (t == error_mark_node);
!   return t;
  }
  
  /* Returns the namespace that contains DECL, whether directly or
*************** stabilize_call (tree call, tree *initp)
*** 2279,2287 ****
    if (call == error_mark_node)
      return;
  
!   if (TREE_CODE (call) != CALL_EXPR
!       && TREE_CODE (call) != AGGR_INIT_EXPR)
!     abort ();
  
    for (t = TREE_OPERAND (call, 1); t; t = TREE_CHAIN (t))
      if (TREE_SIDE_EFFECTS (TREE_VALUE (t)))
--- 2269,2276 ----
    if (call == error_mark_node)
      return;
  
!   gcc_assert (TREE_CODE (call) == CALL_EXPR
! 	      || TREE_CODE (call) == AGGR_INIT_EXPR);
  
    for (t = TREE_OPERAND (call, 1); t; t = TREE_CHAIN (t))
      if (TREE_SIDE_EFFECTS (TREE_VALUE (t)))
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.570
diff -c -3 -p -r1.570 typeck.c
*** cp/typeck.c	27 Aug 2004 17:59:33 -0000	1.570
--- cp/typeck.c	30 Aug 2004 15:11:42 -0000
*************** common_type (tree t1, tree t2)
*** 753,759 ****
      return composite_pointer_type (t1, t2, error_mark_node, error_mark_node,
  				   "conversion");
    else
!     abort ();
  }
  
  /* Compare two exception specifier types for exactness or subsetness, if
--- 753,759 ----
      return composite_pointer_type (t1, t2, error_mark_node, error_mark_node,
  				   "conversion");
    else
!     gcc_unreachable ();
  }
  
  /* Compare two exception specifier types for exactness or subsetness, if
*************** get_member_function_from_ptrfunc (tree *
*** 2353,2359 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
  
        /* Convert down to the right base before using the instance.  First
--- 2353,2359 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
  
        /* Convert down to the right base before using the instance.  First
*************** build_binary_op (enum tree_code code, tr
*** 3081,3091 ****
  	    return e;
  	  return cp_build_binary_op (EQ_EXPR, e, integer_zero_node);
  	}
!       else if ((TYPE_PTRMEMFUNC_P (type0)
! 		&& same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type0), type1))
! 	       || (TYPE_PTRMEMFUNC_P (type1)
! 		   && same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type1), type0)))
! 	abort ();
        break;
  
      case MAX_EXPR:
--- 3081,3096 ----
  	    return e;
  	  return cp_build_binary_op (EQ_EXPR, e, integer_zero_node);
  	}
!       else
! 	{
! 	  gcc_assert (!TYPE_PTRMEMFUNC_P (type0)
! 		      || !same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type0),
! 				       type1));
! 	  gcc_assert (!TYPE_PTRMEMFUNC_P (type1)
! 		      || !same_type_p (TYPE_PTRMEMFUNC_FN_TYPE (type1),
! 				       type0));
! 	}
!       
        break;
  
      case MAX_EXPR:
*************** build_unary_op (enum tree_code code, tre
*** 3975,3988 ****
  	 address of a function is a no-op, so just return the
  	 argument.  */
  
!       if (TREE_CODE (arg) == IDENTIFIER_NODE
! 	  && IDENTIFIER_OPNAME_P (arg))
! 	{
! 	  abort ();
! 	  /* We don't know the type yet, so just work around the problem.
! 	     We know that this will resolve to an lvalue.  */
! 	  return build1 (ADDR_EXPR, unknown_type_node, arg);
! 	}
  
        if (TREE_CODE (arg) == COMPONENT_REF && type_unknown_p (arg)
  	  && !really_overloaded_fn (TREE_OPERAND (arg, 1)))
--- 3980,3987 ----
  	 address of a function is a no-op, so just return the
  	 argument.  */
  
!       gcc_assert (TREE_CODE (arg) != IDENTIFIER_NODE
! 		  || !IDENTIFIER_OPNAME_P (arg));
  
        if (TREE_CODE (arg) == COMPONENT_REF && type_unknown_p (arg)
  	  && !really_overloaded_fn (TREE_OPERAND (arg, 1)))
*************** expand_ptrmemfunc_cst (tree cst, tree *d
*** 5540,5546 ****
  	  break;
  
  	default:
! 	  abort ();
  	}
  
        *pfn = fold (build1 (NOP_EXPR, TYPE_PTRMEMFUNC_FN_TYPE (type),
--- 5539,5545 ----
  	  break;
  
  	default:
! 	  gcc_unreachable ();
  	}
  
        *pfn = fold (build1 (NOP_EXPR, TYPE_PTRMEMFUNC_FN_TYPE (type),
Index: cp/typeck2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck2.c,v
retrieving revision 1.170
diff -c -3 -p -r1.170 typeck2.c
*** cp/typeck2.c	27 Aug 2004 17:59:33 -0000	1.170
--- cp/typeck2.c	30 Aug 2004 15:11:45 -0000
*************** cxx_incomplete_type_diagnostic (tree val
*** 373,379 ****
        (*p_msg_at) ("`%D' has incomplete type", value);
        decl = 1;
      }
! retry:
    /* We must print an error message.  Be clever about what it says.  */
  
    switch (TREE_CODE (type))
--- 373,379 ----
        (*p_msg_at) ("`%D' has incomplete type", value);
        decl = 1;
      }
!  retry:
    /* We must print an error message.  Be clever about what it says.  */
  
    switch (TREE_CODE (type))
*************** retry:
*** 423,429 ****
        break;
      
      default:
!       abort ();
      }
  }
  
--- 423,429 ----
        break;
      
      default:
!       gcc_unreachable ();
      }
  }
  
*************** split_nonconstant_init_1 (tree dest, tre
*** 509,515 ****
        break;
  
      default:
!       abort ();
      }
  }
  
--- 509,515 ----
        break;
  
      default:
!       gcc_unreachable ();
      }
  }
  
*************** store_init_value (tree decl, tree init)
*** 568,576 ****
  
    if (IS_AGGR_TYPE (type))
      {
!       if (! TYPE_HAS_TRIVIAL_INIT_REF (type)
! 	  && TREE_CODE (init) != CONSTRUCTOR)
! 	abort ();
  
        if (TREE_CODE (init) == TREE_LIST)
  	{
--- 568,575 ----
  
    if (IS_AGGR_TYPE (type))
      {
!       gcc_assert (TYPE_HAS_TRIVIAL_INIT_REF (type)
! 		  || TREE_CODE (init) == CONSTRUCTOR);
  
        if (TREE_CODE (init) == TREE_LIST)
  	{
*************** process_init_constructor (tree type, tre
*** 1107,1114 ****
  
  	  next1 = digest_init (TREE_TYPE (field),
  			       TREE_VALUE (tail), &tail1);
! 	  if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST)
! 	    abort ();
  	  tail = tail1;
  	}
        else
--- 1106,1112 ----
  
  	  next1 = digest_init (TREE_TYPE (field),
  			       TREE_VALUE (tail), &tail1);
! 	  gcc_assert (!tail1 || TREE_CODE (tail1) == TREE_LIST);
  	  tail = tail1;
  	}
        else

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