aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cvt.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2017-05-30 20:38:14 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2017-05-30 20:38:14 +0000
commitf012c8ef4b35dcee9b5a3807868d050812d5b3b9 (patch)
tree02e8550289f6ec4b17f911b6571757f54cfb3e19 /gcc/cp/cvt.c
parent3f8efe25d65ce84369573301df1520ba589a5faa (diff)
downloadgcc-f012c8ef4b35dcee9b5a3807868d050812d5b3b9.zip
gcc-f012c8ef4b35dcee9b5a3807868d050812d5b3b9.tar.gz
gcc-f012c8ef4b35dcee9b5a3807868d050812d5b3b9.tar.bz2
C++ template type diff printing
gcc/ChangeLog: * diagnostic-color.c (color_dict): Add "type-diff". (parse_gcc_colors): Update comment. * doc/invoke.texi (Diagnostic Message Formatting Options): Add -fdiagnostics-show-template-tree and -fno-elide-type. (GCC_COLORS): Add type-diff to example. (type-diff=): New. (-fdiagnostics-show-template-tree): New. (-fno-elide-type): New. * pretty-print.c (pp_format): Pass quote and formatters[argno] to the pp_format_decoder callback. Call any m_format_postprocessor's "handle" method. (pretty_printer::pretty_printer): Initialize m_format_postprocessor. (pretty_printer::~pretty_printer): Delete any m_format_postprocessor. * pretty-print.h (printer_fn): Add bool and const char ** parameters. (class format_postprocessor): New class. (struct pretty_printer::format_decoder): Document the new parameters. (struct pretty_printer::m_format_postprocessor): New field. * tree-diagnostic.c (default_tree_printer): Update for new bool and const char ** params. * tree-diagnostic.h (default_tree_printer): Likewise. gcc/c/ChangeLog: * c-objc-common.c (c_tree_printer): Gain bool and const char ** parameters. gcc/c-family/ChangeLog: * c-format.c (gcc_cxxdiag_char_table): Add 'H' and 'I' to format_chars. * c.opt (fdiagnostics-show-template-tree): New option. (felide-type): New option. gcc/cp/ChangeLog: * call.c (perform_implicit_conversion_flags): Convert "from %qT to %qT" to "from %qH to %qI" in diagnostic. (print_conversion_rejection): Replace pairs of %qT with %qH and %qI in various places. (build_user_type_conversion_1): Likewise. (build_integral_nontype_arg_conv): Likewise. (build_conditional_expr_1): Likewise. (convert_like_real): Likewise. (convert_arg_to_ellipsis): Likewise. (joust): Likewise. (initialize_reference): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (cp_convert_to_pointer): Likewise. (convert_to_reference): Likewise. (ocp_convert): Likewise. * error.c (cp_printer): Gain bool and const char ** parameters. (struct deferred_printed_type): New struct. (class cxx_format_postprocessor): New class. (cxx_initialize_diagnostics): Wire up a cxx_format_postprocessor to pp->m_format_postprocessor. (comparable_template_types_p): New function. (newline_and_indent): New function. (arg_to_string): New function. (print_nonequal_arg): New function. (print_template_differences): New function. (type_to_string_with_compare): New function. (print_template_tree_comparison): New function. (append_formatted_chunk): New function. (add_quotes): New function. (cxx_format_postprocessor::handle): New function. (defer_phase_2_of_type_diff): New function. (cp_printer): Add "quoted" and "buffer_ptr" params. Implement %H and %I. * typeck.c (cp_build_binary_op): Replace pairs of %qT with %qH and %qI in various places. (convert_member_func_to_ptr): Likewise. (build_reinterpret_cast_1): Likewise. (convert_for_assignment): Likewise. * typeck2.c (check_narrowing): Likewise. gcc/fortran/ChangeLog: * error.c (gfc_format_decoder): Update for new bool and const char ** params. gcc/testsuite/ChangeLog: * g++.dg/plugin/plugin.exp (plugin_test_list): Add... * g++.dg/plugin/show-template-tree-color-no-elide-type.C: New test case. * g++.dg/plugin/show-template-tree-color.C: New test case. * g++.dg/plugin/show_template_tree_color_plugin.c: New plugin. * g++.dg/template/show-template-tree-2.C: New test case. * g++.dg/template/show-template-tree-3.C: New test case. * g++.dg/template/show-template-tree-4.C: New test case. * g++.dg/template/show-template-tree-no-elide-type.C: New test case. * g++.dg/template/show-template-tree.C: New test case. From-SVN: r248698
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r--gcc/cp/cvt.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index a53c0b3..e8a7ee2 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -86,7 +86,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold,
if (!COMPLETE_TYPE_P (intype))
{
if (complain & tf_error)
- error_at (loc, "can%'t convert from incomplete type %qT to %qT",
+ error_at (loc, "can%'t convert from incomplete type %qH to %qI",
intype, type);
return error_mark_node;
}
@@ -96,7 +96,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold,
{
if ((complain & tf_error)
&& rval == error_mark_node)
- error_at (loc, "conversion of %qE from %qT to %qT is ambiguous",
+ error_at (loc, "conversion of %qE from %qH to %qI is ambiguous",
expr, intype, type);
return rval;
}
@@ -168,7 +168,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold,
if (TYPE_PTRMEMFUNC_P (type))
{
if (complain & tf_error)
- error_at (loc, "cannot convert %qE from type %qT to type %qT",
+ error_at (loc, "cannot convert %qE from type %qH to type %qI",
expr, intype, type);
return error_mark_node;
}
@@ -195,7 +195,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold,
}
}
if (complain & tf_error)
- error_at (loc, "cannot convert %qE from type %qT to type %qT",
+ error_at (loc, "cannot convert %qE from type %qH to type %qI",
expr, intype, type);
return error_mark_node;
}
@@ -221,7 +221,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold,
else if (TYPE_PTRMEM_P (type) && INTEGRAL_CODE_P (form))
{
if (complain & tf_error)
- error_at (loc, "invalid conversion from %qT to %qT", intype, type);
+ error_at (loc, "invalid conversion from %qH to %qI", intype, type);
return error_mark_node;
}
@@ -244,7 +244,7 @@ cp_convert_to_pointer (tree type, tree expr, bool dofold,
return instantiate_type (type, expr, complain);
if (complain & tf_error)
- error_at (loc, "cannot convert %qE from type %qT to type %qT",
+ error_at (loc, "cannot convert %qE from type %qH to type %qI",
expr, intype, type);
return error_mark_node;
}
@@ -464,7 +464,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
&& !at_least_as_qualified_p (ttl, ttr))
{
if (complain & tf_error)
- permerror (loc, "conversion from %qT to %qT discards qualifiers",
+ permerror (loc, "conversion from %qH to %qI discards qualifiers",
ttr, reftype);
else
return error_mark_node;
@@ -514,7 +514,7 @@ convert_to_reference (tree reftype, tree expr, int convtype,
}
if (complain & tf_error)
- error_at (loc, "cannot convert type %qT to type %qT", intype, reftype);
+ error_at (loc, "cannot convert type %qH to type %qI", intype, reftype);
return error_mark_node;
}
@@ -907,7 +907,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
if (invalid_nonstatic_memfn_p (loc, expr, complain))
/* We displayed the error message. */;
else
- error_at (loc, "conversion from %qT to non-scalar type %qT requested",
+ error_at (loc, "conversion from %qH to non-scalar type %qI requested",
TREE_TYPE (expr), type);
}
return error_mark_node;