FreeBSD/contrib/gcc/cp/typeck.c
/* Returns nonzero iff exp is a STRING_CST or the result of applying
   decay_conversion to one.  */
Returns nonzero iff exp is a STRING_CST or the result of applying
decay_conversion to one.
Returns nonzero iff exp is a STRING_CST or the result of applying decay_conversion to one .
int
string_conv_p (tree totype, tree exp, int warn)
{
  tree t;
  if (TREE_CODE (totype) != POINTER_TYPE)
    return 0;
  t = TREE_TYPE (totype);
  if (!same_type_p (t, char_type_node)
      && !same_type_p (t, wchar_type_node))
    return 0;
  if (TREE_CODE (exp) == STRING_CST)
    {
      if (!same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (exp))), t))
	return 0;
    }
  else
    {
      t = build_pointer_type (build_qualified_type (t, TYPE_QUAL_CONST));
      if (!same_type_p (TREE_TYPE (exp), t))
	return 0;
      STRIP_NOPS (exp);
      if (TREE_CODE (exp) != ADDR_EXPR
	  || TREE_CODE (TREE_OPERAND (exp, 0)) != STRING_CST)
	return 0;
    }
  if (warn)
    warning (OPT_Wwrite_strings,
	     "deprecated conversion from string constant to %qT",
	     totype);
  return 1;
}
int string_conv_p ( tree totype , tree exp , int warn ) { tree t ; if ( TREE_CODE ( totype ) != POINTER_TYPE ) return 0 ; t = TREE_TYPE ( totype ) ; if ( ! same_type_p ( t , char_type_node ) && ! same_type_p ( t , wchar_type_node ) ) return 0 ; if ( TREE_CODE ( exp ) == STRING_CST ) { if ( ! same_type_p ( TYPE_MAIN_VARIANT ( TREE_TYPE ( TREE_TYPE ( exp ) ) ) , t ) ) return 0 ; } else { t = build_pointer_type ( build_qualified_type ( t , TYPE_QUAL_CONST ) ) ; if ( ! same_type_p ( TREE_TYPE ( exp ) , t ) ) return 0 ; STRIP_NOPS ( exp ) ; if ( TREE_CODE ( exp ) != ADDR_EXPR || TREE_CODE ( TREE_OPERAND ( exp , 0 ) ) != STRING_CST ) return 0 ; } if ( warn ) warning ( OPT_Wwrite_strings , " " , totype ) ; return 1 ; }
Returns nonzero iff exp is a STRING_CST or the result of applying
decay_conversion to one.
Returns nonzero iff exp is a STRING_CST or the result of applying decay_conversion to one .
/* Make sure that we don't try to convert between char and wchar_t.  */ /* Is this a string constant which has decayed to 'const char *'?  */ /* This warning is not very useful, as it complains about printf.  */