aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/error.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 98b5ebf..3f709ba 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-02 David Malcolm <dmalcolm@redhat.com>
+
+ * error.c (cxx_print_error_function): Duplicate "file" before
+ passing it to pp_set_prefix.
+ (cp_print_error_function): Use pp_take_prefix when saving the
+ existing prefix.
+
2018-08-01 Martin Sebor <msebor@redhat.com>
PR tree-optimization/86650
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index a12fbc5..c49f4d7 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -3287,8 +3287,13 @@ void
cxx_print_error_function (diagnostic_context *context, const char *file,
diagnostic_info *diagnostic)
{
+ char *prefix;
+ if (file)
+ prefix = xstrdup (file);
+ else
+ prefix = NULL;
lhd_print_error_function (context, file, diagnostic);
- pp_set_prefix (context->printer, file);
+ pp_set_prefix (context->printer, prefix);
maybe_print_instantiation_context (context);
}
@@ -3316,7 +3321,7 @@ cp_print_error_function (diagnostic_context *context,
return;
if (diagnostic_last_function_changed (context, diagnostic))
{
- const char *old_prefix = context->printer->prefix;
+ char *old_prefix = pp_take_prefix (context->printer);
const char *file = LOCATION_FILE (diagnostic_location (diagnostic));
tree abstract_origin = diagnostic_abstract_origin (diagnostic);
char *new_prefix = (file && abstract_origin == NULL)