aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-opts.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 811947a..0eade3c 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-01 David Malcolm <dmalcolm@redhat.com>
+
+ * c-opts.c (c_diagnostic_finalizer): Temporarily clear prefix when
+ calling diagnostic_show_locus, rather than destroying it afterwards.
+
2019-10-01 Jakub Jelinek <jakub@redhat.com>
PR c++/91925
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 23ab4cf..949d96a 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -168,11 +168,13 @@ c_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic,
diagnostic_t)
{
+ char *saved_prefix = pp_take_prefix (context->printer);
+ pp_set_prefix (context->printer, NULL);
diagnostic_show_locus (context, diagnostic->richloc, diagnostic->kind);
/* By default print macro expansion contexts in the diagnostic
finalizer -- for tokens resulting from macro expansion. */
virt_loc_aware_diagnostic_finalizer (context, diagnostic);
- pp_destroy_prefix (context->printer);
+ pp_set_prefix (context->printer, saved_prefix);
pp_flush (context->printer);
}