FreeBSD/contrib/gcc/c-common.c
/* Handle a "deprecated" attribute; arguments as in
   struct attribute_spec.handler.  */
Handle a "deprecated" attribute; arguments as in
struct attribute_spec.handler.
Handle a " deprecated " attribute ; arguments as in struct attribute_spec . handler .
static tree
handle_deprecated_attribute (tree *node, tree name,
			     tree ARG_UNUSED (args), int flags,
			     bool *no_add_attrs)
{
  tree type = NULL_TREE;
  int warn = 0;
  tree what = NULL_TREE;
  if (DECL_P (*node))
    {
      tree decl = *node;
      type = TREE_TYPE (decl);
      if (TREE_CODE (decl) == TYPE_DECL
	  || TREE_CODE (decl) == PARM_DECL
	  || TREE_CODE (decl) == VAR_DECL
	  || TREE_CODE (decl) == FUNCTION_DECL
	  || TREE_CODE (decl) == FIELD_DECL)
	TREE_DEPRECATED (decl) = 1;
      else
	warn = 1;
    }
  else if (TYPE_P (*node))
    {
      if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
	*node = build_variant_type_copy (*node);
      TREE_DEPRECATED (*node) = 1;
      type = *node;
    }
  else
    warn = 1;
  if (warn)
    {
      *no_add_attrs = true;
      if (type && TYPE_NAME (type))
	{
	  if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
	    what = TYPE_NAME (*node);
	  else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
		   && DECL_NAME (TYPE_NAME (type)))
	    what = DECL_NAME (TYPE_NAME (type));
	}
      if (what)
	warning (OPT_Wattributes, "%qE attribute ignored for %qE", name, what);
      else
	warning (OPT_Wattributes, "%qE attribute ignored", name);
    }
  return NULL_TREE;
}
static tree handle_deprecated_attribute ( tree * node , tree name , tree ARG_UNUSED ( args ) , int flags , bool * no_add_attrs ) { tree type = NULL_TREE ; int warn = 0 ; tree what = NULL_TREE ; if ( DECL_P ( * node ) ) { tree decl = * node ; type = TREE_TYPE ( decl ) ; if ( TREE_CODE ( decl ) == TYPE_DECL || TREE_CODE ( decl ) == PARM_DECL || TREE_CODE ( decl ) == VAR_DECL || TREE_CODE ( decl ) == FUNCTION_DECL || TREE_CODE ( decl ) == FIELD_DECL ) TREE_DEPRECATED ( decl ) = 1 ; else warn = 1 ; } else if ( TYPE_P ( * node ) ) { if ( ! ( flags & ( int ) ATTR_FLAG_TYPE_IN_PLACE ) ) * node = build_variant_type_copy ( * node ) ; TREE_DEPRECATED ( * node ) = 1 ; type = * node ; } else warn = 1 ; if ( warn ) { * no_add_attrs = true ; if ( type && TYPE_NAME ( type ) ) { if ( TREE_CODE ( TYPE_NAME ( type ) ) == IDENTIFIER_NODE ) what = TYPE_NAME ( * node ) ; else if ( TREE_CODE ( TYPE_NAME ( type ) ) == TYPE_DECL && DECL_NAME ( TYPE_NAME ( type ) ) ) what = DECL_NAME ( TYPE_NAME ( type ) ) ; } if ( what ) warning ( OPT_Wattributes , " " , name , what ) ; else warning ( OPT_Wattributes , " " , name ) ; } return NULL_TREE ; }
Handle a "deprecated" attribute; arguments as in
struct attribute_spec.handler.
Handle a " deprecated " attribute ; arguments as in struct attribute_spec . handler .