On Wed, 2026-02-11 at 10:04 +0100, Jakub Jelinek wrote:
> On Wed, Feb 11, 2026 at 10:02:03AM +0100, Jakub Jelinek wrote:
> > On Wed, Feb 11, 2026 at 05:56:27PM +0900, Jason Merrill wrote:
> > > On 2/11/26 10:50 AM, Marek Polacek wrote:
> > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?
> > > > 
> > > > -- >8 --
> > > > This patch improves various reflection diagnostics as discussed
> > > > in
> > > > <
> > > > https://gcc.gnu.org/pipermail/gcc-patches/2025-December/704168.h
> > > > tml>.
> > > > 
> > > > In particular:
> > > > - reword "not usable" diagnostics to say what kind of
> > > > reflections we
> > > >    expected,
> > > > - use the new tree_category to better describe what kind of
> > > > reflection
> > > >    we actually got,
> > > 
> > > Hmm, building an error message from strings like this is
> > > generally frowned
> > > on because it is difficult to translate.  Maybe add a %R to
> > > cp_printer and a
> > > reflection_to_string function to print any kind of reflection?
> > 
> > %R is taken already,
> >    %r: if pp_show_color(pp), switch to color identified by const
> > char *.
> >    %R: if pp_show_color(pp), reset color.

FWIW I wanted to make it easier to add new pretty print codes so I
added 'e' (as in "%qe") in GCC 15 which takes a
  pp_element *
and so you create a subclass of pp_element which implements printing
itself as a vfunc (and then you don't have to find an unused letter)...

> 
> Though, why not just use %qE and make sure to pass a REFLECT_EXPR and
> ensure it is printed in human readable form (partly kind like
> display_string_of, but e.g. with ^^ at the start).

...but Jakub's idea here sounds better.

Dave

Reply via email to