Commit 96c545e5 by Martin Liska Committed by Martin Liska

Error about alias attribute with body definition (PR c/87483).

2018-10-04  Martin Liska  <mliska@suse.cz>

	PR c/87483
	* cgraphunit.c (process_function_and_variable_attributes):
	Warn about a function with alias attribute and a body.
2018-10-04  Martin Liska  <mliska@suse.cz>

	PR c/87483
	* gcc.dg/pr87483.c: New test.

From-SVN: r264846
parent b8ce8129
2018-10-04 Martin Liska <mliska@suse.cz>
PR c/87483
* cgraphunit.c (process_function_and_variable_attributes):
Warn about a function with alias attribute and a body.
2018-10-04 Martin Liska <mliska@suse.cz>
PR ipa/82625
* multiple_target.c (redirect_to_specific_clone): New function.
(ipa_target_clone): Use it.
......@@ -784,6 +784,12 @@ process_function_and_variable_attributes (cgraph_node *first,
DECL_ATTRIBUTES (decl) = remove_attribute ("weakref",
DECL_ATTRIBUTES (decl));
}
else if (lookup_attribute ("alias", DECL_ATTRIBUTES (decl))
&& node->definition
&& !node->alias)
warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wattributes,
"%<alias%> attribute ignored"
" because function is defined");
if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (decl))
&& !DECL_DECLARED_INLINE_P (decl)
......
2018-10-04 Martin Liska <mliska@suse.cz>
PR c/87483
* gcc.dg/pr87483.c: New test.
2018-10-04 Martin Liska <mliska@suse.cz>
PR ipa/82625
* g++.dg/ext/pr82625.C: New test.
......
/* PR c/87483 */
/* { dg-require-alias "" } */
int f (void) { return 0; }
__attribute__ ((alias ("f"))) int g () { return 1; } /* { dg-warning "attribute ignored because function is defined" } */
__attribute__ ((alias ("f"))) int g2 ();
int h (void)
{
return g2 ();
}
int main()
{
return h();
}
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