On Mon, Mar 4, 2013 at 3:11 PM, Jakub Jelinek <ja...@redhat.com> wrote: > Hi! > > maybe_unwind_expanded_macro_loc now calls diagnostic_append_node > in two places, but often with non-NULL pp_get_prefix (context->printer). > diagnostic_append_node overwrites it with a new value, then frees that > new value and clears it, but that means we leak the old prefix. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk?
Yes. Thanks! -- Gaby > > 2013-03-04 Jakub Jelinek <ja...@redhat.com> > > PR middle-end/56461 > * diagnostic.c (diagnostic_append_note): Save and restore old prefix. > > --- gcc/diagnostic.c.jj 2013-01-15 17:20:35.000000000 +0100 > +++ gcc/diagnostic.c 2013-03-04 17:01:35.735413481 +0100 > @@ -828,6 +828,7 @@ diagnostic_append_note (diagnostic_conte > { > diagnostic_info diagnostic; > va_list ap; > + const char *saved_prefix; > > va_start (ap, gmsgid); > diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_NOTE); > @@ -836,12 +837,14 @@ diagnostic_append_note (diagnostic_conte > va_end (ap); > return; > } > + saved_prefix = pp_get_prefix (context->printer); > pp_set_prefix (context->printer, > diagnostic_build_prefix (context, &diagnostic)); > pp_newline (context->printer); > pp_format (context->printer, &diagnostic.message); > pp_output_formatted_text (context->printer); > pp_destroy_prefix (context->printer); > + pp_set_prefix (context->printer, saved_prefix); > diagnostic_show_locus (context, &diagnostic); > va_end(ap); > } > > Jakub