aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-11-09 17:32:52 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-11-09 10:32:52 -0700
commit79a2c4281c7dcaa6a138d24fd037c62453a12bde (patch)
treedff179677c863457f73ef49310ef719591c305e7 /gcc/cgraphunit.c
parent900dab1338b45c8fa8d1b315dce53712b857da1d (diff)
downloadgcc-79a2c4281c7dcaa6a138d24fd037c62453a12bde.zip
gcc-79a2c4281c7dcaa6a138d24fd037c62453a12bde.tar.gz
gcc-79a2c4281c7dcaa6a138d24fd037c62453a12bde.tar.bz2
PR middle-end/81824 - Warn for missing attributes with function aliases
gcc/c-family/ChangeLog: PR middle-end/81824 * c-attribs.c (handle_copy_attribute): New function. gcc/cp/ChangeLog: PR middle-end/81824 * pt.c (warn_spec_missing_attributes): Move code to attribs.c. Call decls_mismatched_attributes. gcc/ChangeLog: PR middle-end/81824 * attribs.c (has_attribute): New helper function. (decls_mismatched_attributes, maybe_diag_alias_attributes): Same. * attribs.h (decls_mismatched_attributes): Declare. * cgraphunit.c (handle_alias_pairs): Call maybe_diag_alias_attributes. (maybe_diag_incompatible_alias): Use OPT_Wattribute_alias_. * common.opt (-Wattribute-alias): Take an argument. (-Wno-attribute-alias): New option. * doc/extend.texi (Common Function Attributes): Document copy. (Common Variable Attributes): Same. * doc/invoke.texi (-Wmissing-attributes): Document enhancement. (-Wattribute-alias): Document new option argument. gcc/testsuite/ChangeLog: PR middle-end/81824 * gcc.dg/Wattribute-alias.c: New test. * gcc.dg/Wmissing-attributes.c: New test. * gcc.dg/attr-copy.c: New test. * gcc.dg/attr-copy-2.c: New test. * gcc.dg/attr-copy-3.c: New test. * gcc.dg/attr-copy-4.c: New test. From-SVN: r265980
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index cb84954..2f0b70f 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1364,7 +1364,7 @@ maybe_diag_incompatible_alias (tree alias, tree target)
auto_diagnostic_group d;
if (warning_at (DECL_SOURCE_LOCATION (target),
- OPT_Wattribute_alias,
+ OPT_Wattribute_alias_,
"%<ifunc%> resolver for %qD should return %qT",
alias, funcptr))
inform (DECL_SOURCE_LOCATION (alias),
@@ -1374,11 +1374,11 @@ maybe_diag_incompatible_alias (tree alias, tree target)
{
auto_diagnostic_group d;
if (warning_at (DECL_SOURCE_LOCATION (alias),
- OPT_Wattribute_alias,
+ OPT_Wattribute_alias_,
"%qD alias between functions of incompatible "
"types %qT and %qT", alias, altype, targtype))
inform (DECL_SOURCE_LOCATION (target),
- "aliased declaration here");
+ "aliased declaration here");
}
}
}
@@ -1441,6 +1441,8 @@ handle_alias_pairs (void)
{
maybe_diag_incompatible_alias (p->decl, target_node->decl);
+ maybe_diag_alias_attributes (p->decl, target_node->decl);
+
cgraph_node *src_node = cgraph_node::get (p->decl);
if (src_node && src_node->definition)
src_node->reset ();