diff options
author | Gabriel Dos Reis <gdr@integrable-solutions.net> | 2003-09-07 11:59:52 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2003-09-07 11:59:52 +0000 |
commit | 43f9ce025631eabe87889646e50d19c1d228c680 (patch) | |
tree | a13e6b35d663ef787e8ad6315376985896dbd63f /gcc/toplev.c | |
parent | c57e159892e138cdb46977dc063d8a3a9aa91281 (diff) | |
download | gcc-43f9ce025631eabe87889646e50d19c1d228c680.zip gcc-43f9ce025631eabe87889646e50d19c1d228c680.tar.gz gcc-43f9ce025631eabe87889646e50d19c1d228c680.tar.bz2 |
* diagnostic.c (warn_deprecated_use): Move to toplev.c
From-SVN: r71168
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r-- | gcc/toplev.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index 92ef835..aa04138 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1702,6 +1702,44 @@ check_global_declarations (tree *vec, int len) } } +/* Warn about a use of an identifier which was marked deprecated. */ +void +warn_deprecated_use (tree node) +{ + if (node == 0 || !warn_deprecated_decl) + return; + + 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)) + { + const 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"); + } +} + /* Save the current INPUT_LOCATION on the top entry in the INPUT_FILE_STACK. Push a new entry for FILE and LINE, and set the INPUT_LOCATION accordingly. */ |