aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2018-11-08 15:28:20 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2018-11-08 15:28:20 +0000
commitd8010ee4560a947f690891f919db177b03581f9a (patch)
treec6bb3ddeba0c95c166a971951e837fb414559832 /gcc/testsuite/gcc.dg
parent0d8f74b4cf06835a327aaef69787a4b7d9dc8e66 (diff)
dump_printf: add "%C" for dumping cgraph_node *
This patch implements support for %C in dump_printf for dumping cgraph_node *. (I would have preferred to have a code for printing symtab_node * and both subclasses, but there doesn't seem to be a good way for -Wformat to handle inheritance, so, failing that, I went with this approach). gcc/c-family/ChangeLog: * c-format.c (local_cgraph_node_ptr_node): New variable. (gcc_dump_printf_char_table): Add entry for %C. (get_pointer_to_named_type): New function, taken from the handling code for "gimple *" from... (init_dynamic_diag_info): ...here. Add handling for "cgraph_node *". * c-format.h (T_CGRAPH_NODE): New. gcc/ChangeLog: * dump-context.h (ASSERT_IS_CGRAPH_NODE): New macro. * dumpfile.c (make_item_for_dump_cgraph_node): Move to before... (dump_pretty_printer::decode_format): Implement "%C" for cgraph_node *. (selftest::test_capture_of_dump_calls): Rename "where" to "stmt_loc". Convert test_decl to a function decl and set its location. Add a symbol_table_test RAII instance and a cgraph_node, using it to test "%C" and dump_symtab_node. gcc/testsuite/ChangeLog: * gcc.dg/format/gcc_diag-10.c (cgraph_node): New typedef. (test_dump): Add testing of %C. From-SVN: r265918
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/format/gcc_diag-10.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/format/gcc_diag-10.c b/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
index 2f6a002a47f..97a1993dc8f 100644
--- a/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
+++ b/gcc/testsuite/gcc.dg/format/gcc_diag-10.c
@@ -20,7 +20,7 @@ typedef union tree_node *tree;
typedef struct gimple gimple;
/* Likewise for gimple. */
-typedef struct gimple gimple;
+typedef struct cgraph_node cgraph_node;
#define FORMAT(kind) __attribute__ ((format (__gcc_## kind ##__, 1, 2)))
@@ -162,7 +162,7 @@ void test_cxxdiag (tree t, gimple *gc)
cxxdiag ("%<%X%>", t);
}
-void test_dump (tree t, gimple *stmt)
+void test_dump (tree t, gimple *stmt, cgraph_node *node)
{
dump ("%<"); /* { dg-warning "unterminated quoting directive" } */
dump ("%>"); /* { dg-warning "unmatched quoting directive " } */
@@ -182,4 +182,5 @@ void test_dump (tree t, gimple *stmt)
dump ("%E", stmt);
dump ("%T", t);
dump ("%G", stmt);
+ dump ("%C", node);
}