if (!targetm.has_ifunc_p ())
{
error_at (DECL_SOURCE_LOCATION (node->decl),
- "the call requires ifunc, which is not"
+ "the call requires %<ifunc%>, which is not"
" supported by this target");
return;
}
}
/* Return number of attributes separated by comma and put them into ARGS.
- If there is no DEFAULT attribute return -1. If there is an empty
- string in attribute return -2. */
+ If there is no DEFAULT attribute return -1.
+ If there is an empty string in attribute return -2.
+ If there are multiple DEFAULT attributes return -3.
+ */
static int
separate_attrs (char *attr_str, char **attrs, int attrnum)
}
if (default_count == 0)
return -1;
+ else if (default_count > 1)
+ return -3;
else if (i + default_count < attrnum)
return -2;
if (attr_len == -1)
{
warning_at (DECL_SOURCE_LOCATION (node->decl),
- 0,
- "single %<target_clones%> attribute is ignored");
+ 0, "single %<target_clones%> attribute is ignored");
return false;
}
char **attrs = XNEWVEC (char *, attrnum);
attrnum = separate_attrs (attr_str, attrs, attrnum);
- if (attrnum == -1)
+ switch (attrnum)
{
+ case -1:
error_at (DECL_SOURCE_LOCATION (node->decl),
- "default target was not set");
- XDELETEVEC (attrs);
- XDELETEVEC (attr_str);
- return false;
- }
- else if (attrnum == -2)
- {
+ "%<default%> target was not set");
+ break;
+ case -2:
error_at (DECL_SOURCE_LOCATION (node->decl),
"an empty string cannot be in %<target_clones%> attribute");
+ break;
+ case -3:
+ error_at (DECL_SOURCE_LOCATION (node->decl),
+ "multiple %<default%> targets were set");
+ break;
+ default:
+ break;
+ }
+
+ if (attrnum < 0)
+ {
XDELETEVEC (attrs);
XDELETEVEC (attr_str);
return false;