"with %qs attribute", name, "target");
*no_add_attrs = true;
}
+ else if (get_target_clone_attr_len (args) == -1)
+ {
+ warning (OPT_Wattributes,
+ "single %<target_clones%> attribute is ignored");
+ *no_add_attrs = true;
+ }
else
/* Do not inline functions with multiple clone targets. */
DECL_UNINLINABLE (*node) = 1;
}
}
-/* Return length of attribute names string,
- if arglist chain > 1, -1 otherwise. */
-
-static int
-get_attr_len (tree arglist)
-{
- tree arg;
- int str_len_sum = 0;
- int argnum = 0;
-
- for (arg = arglist; arg; arg = TREE_CHAIN (arg))
- {
- const char *str = TREE_STRING_POINTER (TREE_VALUE (arg));
- size_t len = strlen (str);
- str_len_sum += len + 1;
- for (const char *p = strchr (str, ','); p; p = strchr (p + 1, ','))
- argnum++;
- argnum++;
- }
- if (argnum <= 1)
- return -1;
- return str_len_sum;
-}
-
/* Create string with attributes separated by comma.
Return number of attributes. */
return false;
tree arglist = TREE_VALUE (attr_target);
- int attr_len = get_attr_len (arglist);
+ int attr_len = get_target_clone_attr_len (arglist);
/* No need to clone for 1 target attribute. */
if (attr_len == -1)
--- /dev/null
+/* PR ipa/104533 */
+/* { dg-do compile } */
+/* { dg-additional-options "-std=c++11 -fPIC -Ofast -fno-semantic-interposition" } */
+/* { dg-require-ifunc "" } */
+
+struct B
+{
+ virtual ~B();
+};
+__attribute__((target_clones("avx")))
+B::~B() = default; /* { dg-warning "single .target_clones. attribute is ignored" } */
return NULL_TREE;
}
+/* Return length of attribute names string,
+ if arglist chain > 1, -1 otherwise. */
+
+int
+get_target_clone_attr_len (tree arglist)
+{
+ tree arg;
+ int str_len_sum = 0;
+ int argnum = 0;
+
+ for (arg = arglist; arg; arg = TREE_CHAIN (arg))
+ {
+ const char *str = TREE_STRING_POINTER (TREE_VALUE (arg));
+ size_t len = strlen (str);
+ str_len_sum += len + 1;
+ for (const char *p = strchr (str, ','); p; p = strchr (p + 1, ','))
+ argnum++;
+ argnum++;
+ }
+ if (argnum <= 1)
+ return -1;
+ return str_len_sum;
+}
+
#if CHECKING_P
namespace selftest {
object or pointer. Otherwise return null. */
extern tree get_attr_nonstring_decl (tree, tree * = NULL);
+extern int get_target_clone_attr_len (tree);
+
#endif /* GCC_TREE_H */