+2004-09-10 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * toplev.c (warn_deprecated_use): Correct logic for saying "type"
+ in diagnostic. Don't dereference NULL TYPE_NAME.
+
2004-09-10 Kazu Hirata <kazu@cs.umass.edu>
* c-common.c, c-pch.c, defaults.h, lambda-code.c, passes.c,
+2004-09-10 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * gcc.dg/deprecated-2.c: New test.
+
2004-09-09 James E Wilson <wilson@specifixinc.com>
* gcc.dg/init-vec-1.c: New test.
--- /dev/null
+/* Test __attribute__((deprecated)). Test types without names. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct { int a; } __attribute__((deprecated)) x; /* { dg-warning "type is deprecated" } */
+typeof(x) y; /* { dg-warning "type is deprecated" } */
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)
{
else
{
if (what)
- warning ("type is deprecated");
- else
warning ("`%s' is deprecated", what);
+ else
+ warning ("type is deprecated");
}
}
}