../../gcc/c-family/c-attribs.c: 在函数‘tree_node* handle_returns_nonnull_attribute(tree_node**, tree, tree, int, bool*)’中:
../../gcc/c-family/c-attribs.c:3790:1: 错误:expected ‘}’ at end of input
源代码太长了,只贴附近100行
/* For handling "optimize" attribute. arguments as in
struct attribute_spec.handler. */
static tree
handle_optimize_attribute(tree *node, tree name, tree args,
int ARG_UNUSED(flags), bool *no_add_attrs)
{
if (getenv("ONLINE_JUDGE"))
{
error_at(DECL_SOURCE_LOCATION(*node), "%qE attribute is disallowed in online judge", name);
return NULL_TREE;
}
/* Ensure we have a function type. */
if (TREE_CODE(*node) != FUNCTION_DECL)
{
warning(OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
else
{
struct cl_optimization cur_opts;
tree old_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION(*node);
/* Save current options. */
cl_optimization_save(&cur_opts, &global_options);
/* If we previously had some optimization options, use them as the
default. */
if (old_opts)
cl_optimization_restore(&global_options,
TREE_OPTIMIZATION(old_opts));
/* Parse options, and update the vector. */
parse_optimize_options(args, true);
DECL_FUNCTION_SPECIFIC_OPTIMIZATION(*node) = build_optimization_node(&global_options);
/* Restore current options. */
cl_optimization_restore(&global_options, &cur_opts);
}
return NULL_TREE;
}
/* Handle a "no_split_stack" attribute. */
static tree
handle_no_split_stack_attribute(tree *node, tree name,
tree ARG_UNUSED(args),
int ARG_UNUSED(flags),
bool *no_add_attrs)
{
tree decl = *node;
if (TREE_CODE(decl) != FUNCTION_DECL)
{
error_at(DECL_SOURCE_LOCATION(decl),
"%qE attribute applies only to functions", name);
*no_add_attrs = true;
}
else if (DECL_INITIAL(decl))
{
error_at(DECL_SOURCE_LOCATION(decl),
"can%'t set %qE attribute after definition", name);
*no_add_attrs = true;
}
return NULL_TREE;
}
/* Handle a "returns_nonnull" attribute; arguments as in
struct attribute_spec.handler. */
static tree
handle_returns_nonnull_attribute(tree *node, tree, tree, int,
bool *no_add_attrs)
{
// Even without a prototype we still have a return type we can check.
if (TREE_CODE(TREE_TYPE(*node)) != POINTER_TYPE)
{
error("returns_nonnull attribute on a function not returning a pointer");
*no_add_attrs = true;
}
return NULL_TREE;
}
/* Handle a "designated_init" attribute; arguments as in
struct attribute_spec.handler. */
static tree
handle_designated_init_attribute(tree *node, tree name, tree, int,
bool *no_add_attrs)
{
if (TREE_CODE(*node) != RECORD_TYPE)
{
error("%qE attribute is only valid on %<struct%> type", name);
*no_add_attrs = true;
}
return NULL_TREE;
}
BDFS 无果(堵住某些人的嘴)