@@ -214,6 +214,13 @@ static const struct attribute_spec::exclusions attr_inline_exclusions[] =
ATTR_EXCL (NULL, false, false, false),
};
+static const struct attribute_spec::exclusions attr_always_inline_exclusions[] =
+{
+ ATTR_EXCL ("noinline", true, true, true),
+ ATTR_EXCL ("target_clones", true, true, true),
+ ATTR_EXCL (NULL, false, false, false),
+};
+
static const struct attribute_spec::exclusions attr_noinline_exclusions[] =
{
ATTR_EXCL ("always_inline", true, true, true),
@@ -221,6 +228,19 @@ static const struct attribute_spec::exclusions attr_noinline_exclusions[] =
ATTR_EXCL (NULL, false, false, false),
};
+static const struct attribute_spec::exclusions attr_target_exclusions[] =
+{
+ ATTR_EXCL ("target_clones", true, true, true),
+ ATTR_EXCL (NULL, false, false, false),
+};
+
+static const struct attribute_spec::exclusions attr_target_clones_exclusions[] =
+{
+ ATTR_EXCL ("always_inline", true, true, true),
+ ATTR_EXCL ("target", true, true, true),
+ ATTR_EXCL (NULL, false, false, false),
+};
+
extern const struct attribute_spec::exclusions attr_noreturn_exclusions[] =
{
ATTR_EXCL ("alloc_align", true, true, true),
@@ -332,7 +352,7 @@ const struct attribute_spec c_common_attribute_table[] =
handle_leaf_attribute, NULL },
{ "always_inline", 0, 0, true, false, false, false,
handle_always_inline_attribute,
- attr_inline_exclusions },
+ attr_always_inline_exclusions },
{ "gnu_inline", 0, 0, true, false, false, false,
handle_gnu_inline_attribute,
attr_inline_exclusions },
@@ -483,9 +503,11 @@ const struct attribute_spec c_common_attribute_table[] =
{ "error", 1, 1, true, false, false, false,
handle_error_attribute, NULL },
{ "target", 1, -1, true, false, false, false,
- handle_target_attribute, NULL },
+ handle_target_attribute,
+ attr_target_exclusions },
{ "target_clones", 1, -1, true, false, false, false,
- handle_target_clones_attribute, NULL },
+ handle_target_clones_attribute,
+ attr_target_clones_exclusions },
{ "optimize", 1, -1, true, false, false, false,
handle_optimize_attribute, NULL },
/* For internal use only. The leading '*' both prevents its usage in
@@ -1397,16 +1419,7 @@ handle_noinline_attribute (tree *node, tree name,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
if (TREE_CODE (*node) == FUNCTION_DECL)
- {
- if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (*node)))
- {
- warning (OPT_Wattributes, "%qE attribute ignored due to conflict "
- "with attribute %qs", name, "always_inline");
- *no_add_attrs = true;
- }
- else
- DECL_UNINLINABLE (*node) = 1;
- }
+ DECL_UNINLINABLE (*node) = 1;
else
{
warning (OPT_Wattributes, "%qE attribute ignored", name);
@@ -1487,22 +1500,9 @@ handle_always_inline_attribute (tree *node, tree name,
{
if (TREE_CODE (*node) == FUNCTION_DECL)
{
- if (lookup_attribute ("noinline", DECL_ATTRIBUTES (*node)))
- {
- warning (OPT_Wattributes, "%qE attribute ignored due to conflict "
- "with %qs attribute", name, "noinline");
- *no_add_attrs = true;
- }
- else if (lookup_attribute ("target_clones", DECL_ATTRIBUTES (*node)))
- {
- warning (OPT_Wattributes, "%qE attribute ignored due to conflict "
- "with %qs attribute", name, "target_clones");
- *no_add_attrs = true;
- }
- else
- /* Set the attribute and mark it for disregarding inline
- limits. */
- DECL_DISREGARD_INLINE_LIMITS (*node) = 1;
+ /* Set the attribute and mark it for disregarding inline
+ limits. */
+ DECL_DISREGARD_INLINE_LIMITS (*node) = 1;
}
else
{
@@ -5650,12 +5650,6 @@ handle_target_attribute (tree *node, tree name, tree args, int flags,
warning (OPT_Wattributes, "%qE attribute ignored", name);
*no_add_attrs = true;
}
- else if (lookup_attribute ("target_clones", DECL_ATTRIBUTES (*node)))
- {
- warning (OPT_Wattributes, "%qE attribute ignored due to conflict "
- "with %qs attribute", name, "target_clones");
- *no_add_attrs = true;
- }
else if (! targetm.target_option.valid_attribute_p (*node, name, args,
flags))
*no_add_attrs = true;
@@ -5696,19 +5690,7 @@ handle_target_clones_attribute (tree *node, tree name, tree ARG_UNUSED (args),
}
}
- if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (*node)))
- {
- warning (OPT_Wattributes, "%qE attribute ignored due to conflict "
- "with %qs attribute", name, "always_inline");
- *no_add_attrs = true;
- }
- else if (lookup_attribute ("target", DECL_ATTRIBUTES (*node)))
- {
- warning (OPT_Wattributes, "%qE attribute ignored due to conflict "
- "with %qs attribute", name, "target");
- *no_add_attrs = true;
- }
- else if (get_target_clone_attr_len (args) == -1)
+ if (get_target_clone_attr_len (args) == -1)
{
warning (OPT_Wattributes,
"single %<target_clones%> attribute is ignored");
@@ -3,7 +3,7 @@
__attribute__((target_clones("avx","arch=slm","default")))
__attribute__((target("avx")))
-int foo (); /* { dg-warning "'target' attribute ignored due to conflict with 'target_clones' attribute" } */
+int foo (); /* { dg-warning "ignoring attribute 'target' because it conflicts with attribute 'target_clones'" } */
__attribute__((target_clones("avx","arch=slm","default"),always_inline))
-int bar (); /* { dg-warning "'always_inline' attribute ignored due to conflict with 'target_clones' attribute" } */
+int bar (); /* { dg-warning "ignoring attribute 'always_inline' because it conflicts with attribute 'target_clones'" } */
@@ -3,7 +3,7 @@
__attribute__((target("avx")))
__attribute__((target_clones("avx","arch=slm","default")))
-int foo (); /* { dg-warning "'target_clones' attribute ignored due to conflict with 'target' attribute" } */
+int foo (); /* { dg-warning "ignoring attribute 'target_clones' because it conflicts with attribute 'target'" } */
__attribute__((always_inline,target_clones("avx","arch=slm","default")))
-int bar (); /* { dg-warning "'target_clones' attribute ignored due to conflict with 'always_inline' attribute" } */
+int bar (); /* { dg-warning "ignoring attribute 'target_clones' because it conflicts with attribute 'always_inline'" } */