diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-09-10 11:54:25 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-09-10 11:54:25 +0100 |
commit | 108ebf88b21935d2e28ffe205b2126b49acf9e12 (patch) | |
tree | ed2baafd2f1b72a27341679804ac68b6b935c411 /gcc/toplev.c | |
parent | 6cb38cd4ae4e293f992f0593813c162803e533b9 (diff) | |
download | gcc-108ebf88b21935d2e28ffe205b2126b49acf9e12.tar.gz |
toplev.c (warn_deprecated_use): Correct logic for saying "type" in diagnostic.
* toplev.c (warn_deprecated_use): Correct logic for saying "type"
in diagnostic. Don't dereference NULL TYPE_NAME.
testsuite:
* gcc.dg/deprecated-2.c: New test.
From-SVN: r87289
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r-- | gcc/toplev.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index c3cae64b296..79094e2e039 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -900,11 +900,14 @@ warn_deprecated_use (tree 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 (TYPE_NAME (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 (decl) { @@ -920,9 +923,9 @@ warn_deprecated_use (tree node) else { if (what) - warning ("type is deprecated"); - else warning ("`%s' is deprecated", what); + else + warning ("type is deprecated"); } } } |