summaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-08 18:44:50 +0000
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-08 18:44:50 +0000
commit45c4e79882e6f8943a5fd2dafe9450a46d54247a (patch)
tree3d22aee346c9c7a9e1f97b4a70e8968a3e82e462 /gcc/c-common.c
parent3a45c25eac813e65baed5a9a510b1aced2d67f73 (diff)
downloadgcc-45c4e79882e6f8943a5fd2dafe9450a46d54247a.tar.gz
gcc/
2009-05-08 H.J. Lu <hongjiu.lu@intel.com> Andrew Morrow <acm@google.com> PR c/36892 * c-common.c (c_common_attribute_table): Permit deprecated attribute to take an optional argument. (handle_deprecated_attribute): If the optional argument to __attribute__((deprecated)) is not a string ignore the attribute and emit a warning. * c-decl.c (grokdeclarator): Updated warn_deprecated_use call. * c-typeck.c (build_component_ref): Likewise. (build_external_ref): Likewise. * toplev.c (warn_deprecated_use): Add an attribute argument. Emit the message associated with __attribute__((deprecated)). * toplev.h (warn_deprecated_use): Updated. * doc/extend.texi: Document new optional parameter to __attribute__((deprecated)) gcc/cp/ 2009-05-08 H.J. Lu <hongjiu.lu@intel.com> PR c/36892 * call.c (build_call_a): Updated warn_deprecated_use call. (build_over_call): Likewise. * decl.c (grokdeclarator): Likewise. (grokparms): Likewise. * semantics.c (finish_id_expression): Likewise. * typeck.c (build_class_member_access_expr): Likewise. (finish_class_member_access_expr): Likewise. gcc/testsuite/ 2009-05-08 H.J. Lu <hongjiu.lu@intel.com> PR c/36892 * g++.dg/warn/deprecated-6.C: New. * gcc.dg/deprecated-4.c: Likewise. * gcc.dg/deprecated-5.c: Likewise. * gcc.dg/deprecated-6.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147293 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 9fa3b96aa61..df6673c000c 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -954,7 +954,7 @@ const struct attribute_spec c_common_attribute_table[] =
to prevent its usage in source code. */
{ "no vops", 0, 0, true, false, false,
handle_novops_attribute },
- { "deprecated", 0, 0, false, false, false,
+ { "deprecated", 0, 1, false, false, false,
handle_deprecated_attribute },
{ "vector_size", 1, 1, false, true, false,
handle_vector_size_attribute },
@@ -7179,13 +7179,21 @@ handle_novops_attribute (tree *node, tree ARG_UNUSED (name),
static tree
handle_deprecated_attribute (tree *node, tree name,
- tree ARG_UNUSED (args), int flags,
+ tree args, int flags,
bool *no_add_attrs)
{
tree type = NULL_TREE;
int warn = 0;
tree what = NULL_TREE;
+ if (!args)
+ *no_add_attrs = true;
+ else if (TREE_CODE (TREE_VALUE (args)) != STRING_CST)
+ {
+ error ("deprecated message is not a string");
+ *no_add_attrs = true;
+ }
+
if (DECL_P (*node))
{
tree decl = *node;