summaryrefslogtreecommitdiff
path: root/gcc/cp/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/error.c')
-rw-r--r--gcc/cp/error.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 62e39d3bcbf..5f997c3ed29 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1595,13 +1595,16 @@ dump_exception_spec (cxx_pretty_printer *pp, tree t, int flags)
if (t && TREE_PURPOSE (t))
{
pp_cxx_ws_string (pp, "noexcept");
- pp_cxx_whitespace (pp);
- pp_cxx_left_paren (pp);
- if (DEFERRED_NOEXCEPT_SPEC_P (t))
- pp_cxx_ws_string (pp, "<uninstantiated>");
- else
- dump_expr (pp, TREE_PURPOSE (t), flags);
- pp_cxx_right_paren (pp);
+ if (!integer_onep (TREE_PURPOSE (t)))
+ {
+ pp_cxx_whitespace (pp);
+ pp_cxx_left_paren (pp);
+ if (DEFERRED_NOEXCEPT_SPEC_P (t))
+ pp_cxx_ws_string (pp, "<uninstantiated>");
+ else
+ dump_expr (pp, TREE_PURPOSE (t), flags);
+ pp_cxx_right_paren (pp);
+ }
}
else if (t)
{
@@ -2852,7 +2855,7 @@ fndecl_to_string (tree fndecl, int verbose)
static const char *
code_to_string (enum tree_code c)
{
- return tree_code_name [c];
+ return get_tree_code_name (c);
}
const char *
@@ -2995,6 +2998,15 @@ cv_to_string (tree p, int v)
return pp_ggc_formatted_text (cxx_pp);
}
+static const char *
+eh_spec_to_string (tree p, int /*v*/)
+{
+ int flags = 0;
+ reinit_cxx_pp ();
+ dump_exception_spec (cxx_pp, p, flags);
+ return pp_ggc_formatted_text (cxx_pp);
+}
+
/* Langhook for print_error_function. */
void
cxx_print_error_function (diagnostic_context *context, const char *file,
@@ -3376,8 +3388,10 @@ maybe_print_constexpr_context (diagnostic_context *context)
%O binary operator.
%P function parameter whose position is indicated by an integer.
%Q assignment operator.
+ %S substitution (template + args)
%T type.
- %V cv-qualifier. */
+ %V cv-qualifier.
+ %X exception-specification. */
static bool
cp_printer (pretty_printer *pp, text_info *text, const char *spec,
int precision, bool wide, bool set_locus, bool verbose)
@@ -3424,6 +3438,7 @@ cp_printer (pretty_printer *pp, text_info *text, const char *spec,
case 'S': result = subst_to_string (next_tree); break;
case 'T': result = type_to_string (next_tree, verbose); break;
case 'V': result = cv_to_string (next_tree, verbose); break;
+ case 'X': result = eh_spec_to_string (next_tree, verbose); break;
case 'K':
percent_K_format (text);