contrib/gcc-4.7/gcc/cp/typeck.c
/* Return the common type of two parameter lists.
   We assume that comptypes has already been done and returned 1;
   if that isn't so, this may crash.

   As an optimization, free the space we allocate if the parameter
   lists are already common.  */
Return the common type of two parameter lists.
We assume that comptypes has already been done and returned 1;
if that isn't so, this may crash.

As an optimization, free the space we allocate if the parameter
lists are already common.
Return the common type of two parameter lists . We assume that comptypes has already been done and returned 1 ; if that isn ' t so this may crash . As an optimization free the space we allocate if the parameter lists are already common .
static tree
commonparms (tree p1, tree p2)
{
  tree oldargs = p1, newargs, n;
  int i, len;
  int any_change = 0;
  len = list_length (p1);
  newargs = tree_last (p1);
  if (newargs == void_list_node)
    i = 1;
  else
    {
      i = 0;
      newargs = 0;
    }
  for (; i < len; i++)
    newargs = tree_cons (NULL_TREE, NULL_TREE, newargs);
  n = newargs;
  for (i = 0; p1;
       p1 = TREE_CHAIN (p1), p2 = TREE_CHAIN (p2), n = TREE_CHAIN (n), i++)
    {
      if (TREE_PURPOSE (p1) && !TREE_PURPOSE (p2))
	{
	  TREE_PURPOSE (n) = TREE_PURPOSE (p1);
	  any_change = 1;
	}
      else if (! TREE_PURPOSE (p1))
	{
	  if (TREE_PURPOSE (p2))
	    {
	      TREE_PURPOSE (n) = TREE_PURPOSE (p2);
	      any_change = 1;
	    }
	}
      else
	{
	  if (1 != simple_cst_equal (TREE_PURPOSE (p1), TREE_PURPOSE (p2)))
	    any_change = 1;
	  TREE_PURPOSE (n) = TREE_PURPOSE (p2);
	}
      if (TREE_VALUE (p1) != TREE_VALUE (p2))
	{
	  any_change = 1;
	  TREE_VALUE (n) = merge_types (TREE_VALUE (p1), TREE_VALUE (p2));
	}
      else
	TREE_VALUE (n) = TREE_VALUE (p1);
    }
  if (! any_change)
    return oldargs;
  return newargs;
}
static tree commonparms ( tree p1 , tree p2 ) { tree oldargs = p1 , newargs , n ; int i , len ; int any_change = 0 ; len = list_length ( p1 ) ; newargs = tree_last ( p1 ) ; if ( newargs == void_list_node ) i = 1 ; else { i = 0 ; newargs = 0 ; } for ( ; i < len ; i ++ ) newargs = tree_cons ( NULL_TREE , NULL_TREE , newargs ) ; n = newargs ; for ( i = 0 ; p1 ; p1 = TREE_CHAIN ( p1 ) , p2 = TREE_CHAIN ( p2 ) , n = TREE_CHAIN ( n ) , i ++ ) { if ( TREE_PURPOSE ( p1 ) && ! TREE_PURPOSE ( p2 ) ) { TREE_PURPOSE ( n ) = TREE_PURPOSE ( p1 ) ; any_change = 1 ; } else if ( ! TREE_PURPOSE ( p1 ) ) { if ( TREE_PURPOSE ( p2 ) ) { TREE_PURPOSE ( n ) = TREE_PURPOSE ( p2 ) ; any_change = 1 ; } } else { if ( 1 != simple_cst_equal ( TREE_PURPOSE ( p1 ) , TREE_PURPOSE ( p2 ) ) ) any_change = 1 ; TREE_PURPOSE ( n ) = TREE_PURPOSE ( p2 ) ; } if ( TREE_VALUE ( p1 ) != TREE_VALUE ( p2 ) ) { any_change = 1 ; TREE_VALUE ( n ) = merge_types ( TREE_VALUE ( p1 ) , TREE_VALUE ( p2 ) ) ; } else TREE_VALUE ( n ) = TREE_VALUE ( p1 ) ; } if ( ! any_change ) return oldargs ; return newargs ; }
Return the common type of two parameter lists.
Return the common type of two parameter lists .