FreeBSD/contrib/gcc/cp/name-lookup.c
/* Check to see whether or not DECL is a variable that would have been
   in scope under the ARM, but is not in scope under the ANSI/ISO
   standard.  If so, issue an error message.  If name lookup would
   work in both cases, but return a different result, this function
   returns the result of ANSI/ISO lookup.  Otherwise, it returns
   DECL.  */
Check to see whether or not DECL is a variable that would have been
in scope under the ARM, but is not in scope under the ANSI/ISO
standard.  If so, issue an error message.  If name lookup would
work in both cases, but return a different result, this function
returns the result of ANSI/ISO lookup.  Otherwise, it returns
DECL.
Check to see whether or not DECL is a variable that would have been in scope under the ARM but is not in scope under the ANSI / ISO standard . If so issue an error message . If name lookup would work in both cases but return a different result this function returns the result of ANSI / ISO lookup . Otherwise it returns DECL .
tree
check_for_out_of_scope_variable (tree decl)
{
  tree shadowed;
  if (!(TREE_CODE (decl) == VAR_DECL && DECL_DEAD_FOR_LOCAL (decl)))
    return decl;
  shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (decl)
    ? DECL_SHADOWED_FOR_VAR (decl) : NULL_TREE ;
  while (shadowed != NULL_TREE && TREE_CODE (shadowed) == VAR_DECL
	 && DECL_DEAD_FOR_LOCAL (shadowed))
    shadowed = DECL_HAS_SHADOWED_FOR_VAR_P (shadowed)
      ? DECL_SHADOWED_FOR_VAR (shadowed) : NULL_TREE;
  if (!shadowed)
    shadowed = IDENTIFIER_NAMESPACE_VALUE (DECL_NAME (decl));
  if (shadowed)
    {
      if (!DECL_ERROR_REPORTED (decl))
	{
	  warning (0, "name lookup of %qD changed", DECL_NAME (decl));
	  warning (0, "  matches this %q+D under ISO standard rules",
		   shadowed);
	  warning (0, "  matches this %q+D under old rules", decl);
	  DECL_ERROR_REPORTED (decl) = 1;
	}
      return shadowed;
    }
  if (DECL_ERROR_REPORTED (decl))
    return decl;
  DECL_ERROR_REPORTED (decl) = 1;
  if (TREE_TYPE (decl) == error_mark_node)
    return decl;
  if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
    {
      error ("name lookup of %qD changed for new ISO %<for%> scoping",
	     DECL_NAME (decl));
      error ("  cannot use obsolete binding at %q+D because "
	     "it has a destructor", decl);
      return error_mark_node;
    }
  else
    {
      pedwarn ("name lookup of %qD changed for new ISO %<for%> scoping",
	       DECL_NAME (decl));
      pedwarn ("  using obsolete binding at %q+D", decl);
    }
  return decl;
}
tree check_for_out_of_scope_variable ( tree decl ) { tree shadowed ; if ( ! ( TREE_CODE ( decl ) == VAR_DECL && DECL_DEAD_FOR_LOCAL ( decl ) ) ) return decl ; shadowed = DECL_HAS_SHADOWED_FOR_VAR_P ( decl ) ? DECL_SHADOWED_FOR_VAR ( decl ) : NULL_TREE ; while ( shadowed != NULL_TREE && TREE_CODE ( shadowed ) == VAR_DECL && DECL_DEAD_FOR_LOCAL ( shadowed ) ) shadowed = DECL_HAS_SHADOWED_FOR_VAR_P ( shadowed ) ? DECL_SHADOWED_FOR_VAR ( shadowed ) : NULL_TREE ; if ( ! shadowed ) shadowed = IDENTIFIER_NAMESPACE_VALUE ( DECL_NAME ( decl ) ) ; if ( shadowed ) { if ( ! DECL_ERROR_REPORTED ( decl ) ) { warning ( 0 , " " , DECL_NAME ( decl ) ) ; warning ( 0 , " " , shadowed ) ; warning ( 0 , " " , decl ) ; DECL_ERROR_REPORTED ( decl ) = 1 ; } return shadowed ; } if ( DECL_ERROR_REPORTED ( decl ) ) return decl ; DECL_ERROR_REPORTED ( decl ) = 1 ; if ( TREE_TYPE ( decl ) == error_mark_node ) return decl ; if ( TYPE_HAS_NONTRIVIAL_DESTRUCTOR ( TREE_TYPE ( decl ) ) ) { error ( " " , DECL_NAME ( decl ) ) ; error ( " " " " , decl ) ; return error_mark_node ; } else { pedwarn ( " " , DECL_NAME ( decl ) ) ; pedwarn ( " " , decl ) ; } return decl ; }
Check to see whether or not DECL is a variable that would have been
in scope under the ARM, but is not in scope under the ANSI/ISO
standard.
Check to see whether or not DECL is a variable that would have been in scope under the ARM but is not in scope under the ANSI / ISO standard .
/* We only care about out of scope variables.  */ /* If we have already complained about this declaration, there's no
     need to do it again.  */