summaryrefslogtreecommitdiff
path: root/libgomp/libgomp.h
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 /libgomp/libgomp.h
parent900dab1338b45c8fa8d1b315dce53712b857da1d (diff)
downloadgcc-79a2c4281c7dcaa6a138d24fd037c62453a12bde.tar.gz
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 'libgomp/libgomp.h')
-rw-r--r--libgomp/libgomp.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index 828e9b0095b..7eacb45db66 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -1149,16 +1149,26 @@ extern int gomp_test_nest_lock_25 (omp_nest_lock_25_t *) __GOMP_NOTHROW;
# define attribute_hidden
#endif
+#if __GNUC__ >= 9
+# define HAVE_ATTRIBUTE_COPY
+#endif
+
+#ifdef HAVE_ATTRIBUTE_COPY
+# define attribute_copy(arg) __attribute__ ((copy (arg)))
+#else
+# define attribute_copy(arg)
+#endif
+
#ifdef HAVE_ATTRIBUTE_ALIAS
# define strong_alias(fn, al) \
- extern __typeof (fn) al __attribute__ ((alias (#fn)));
+ extern __typeof (fn) al __attribute__ ((alias (#fn))) attribute_copy (fn);
# define ialias_ulp ialias_str1(__USER_LABEL_PREFIX__)
# define ialias_str1(x) ialias_str2(x)
# define ialias_str2(x) #x
# define ialias(fn) \
extern __typeof (fn) gomp_ialias_##fn \
- __attribute__ ((alias (#fn))) attribute_hidden;
+ __attribute__ ((alias (#fn))) attribute_hidden attribute_copy (fn);
# define ialias_redirect(fn) \
extern __typeof (fn) fn __asm__ (ialias_ulp "gomp_ialias_" #fn) attribute_hidden;
# define ialias_call(fn) gomp_ialias_ ## fn