summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorira <ira@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-10 18:51:24 +0000
committerira <ira@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-10 18:51:24 +0000
commit88da234dc7be67523c21ab558bd6e8b04aff7842 (patch)
treeea5ad261c8b70074c9c7c1c74de2f56e14b206cd /gcc/diagnostic.c
parentb3a976d8079392f6be31f4fe1ed477f34d9fe315 (diff)
downloadgcc-88da234dc7be67523c21ab558bd6e8b04aff7842.tar.gz
Added __attribute__((deprecated)) patches.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48743 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index d5664015979..ac3539beda1 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -1520,3 +1520,44 @@ default_diagnostic_finalizer (buffer, dc)
{
output_destroy_prefix (buffer);
}
+
+void
+warn_deprecated_use (node)
+ tree node;
+{
+ if (node && warn_deprecated_decl)
+ if (DECL_P (node))
+ {
+ warning ("`%s' is deprecated (declared at %s:%d)",
+ IDENTIFIER_POINTER (DECL_NAME (node)),
+ DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
+ }
+ else if (TYPE_P (node))
+ {
+ char *what = NULL;
+ tree decl = TYPE_STUB_DECL (node);
+
+ if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
+ what = IDENTIFIER_POINTER (TYPE_NAME (node));
+ else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
+ && DECL_NAME (TYPE_NAME (node)))
+ what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
+
+ if (what)
+ {
+ if (decl)
+ warning ("`%s' is deprecated (declared at %s:%d)", what,
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ else
+ warning ("`%s' is deprecated", what);
+ }
+ else
+ {
+ if (decl)
+ warning ("type is deprecated (declared at %s:%d)",
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
+ else
+ warning ("type is deprecated");
+ }
+ }
+}