Commit 2b7d0696 by Martin Liska Committed by Martin Liska

Fix target attribute handling (PR c++/81355).

2017-08-10  Martin Liska  <mliska@suse.cz>

	PR c++/81355
	* c-attribs.c (handle_target_attribute):
	Report warning for an empty string argument of target attribute.
2017-08-10  Martin Liska  <mliska@suse.cz>

	PR c++/81355
	* g++.dg/other/pr81355.C: New test.

From-SVN: r251020
parent 50aa16c3
2017-08-10 Martin Liska <mliska@suse.cz>
PR c++/81355
* c-attribs.c (handle_target_attribute):
Report warning for an empty string argument of target attribute.
2017-08-09 Jakub Jelinek <jakub@redhat.com>
PR c/81687
......
......@@ -3139,6 +3139,19 @@ handle_target_attribute (tree *node, tree name, tree args, int flags,
flags))
*no_add_attrs = true;
/* Check that there's no empty string in values of the attribute. */
for (tree t = args; t != NULL_TREE; t = TREE_CHAIN (t))
{
tree value = TREE_VALUE (t);
if (TREE_CODE (value) == STRING_CST
&& TREE_STRING_LENGTH (value) == 1
&& TREE_STRING_POINTER (value)[0] == '\0')
{
warning (OPT_Wattributes, "empty string in attribute %<target%>");
*no_add_attrs = true;
}
}
return NULL_TREE;
}
......
2017-08-10 Martin Liska <mliska@suse.cz>
PR c++/81355
* g++.dg/other/pr81355.C: New test.
2017-08-09 David Malcolm <dmalcolm@redhat.com>
* jit.dg/all-non-failing-tests.h: Add note about
......
/* { dg-do compile { target x86_64-*-* } } */
__attribute__((target("default")))
int foo() {return 1;}
__attribute__((target("arch=core2", "")))
int foo2() {return 2;} /* { dg-warning "empty string in attribute .target." } */
__attribute__((target("sse4.2", "", "")))
int foo3() {return 2;} /* { dg-warning "empty string in attribute .target." } */
int main() {
return foo() + foo2() + foo3();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment