On Tue, Apr 20, 2021 at 05:55:46PM +0200, Andreas Schwab wrote:
> On Nov 13 2020, Nikhil Benesch via Gcc-patches wrote:
>
> > +static void
> > +demangle_const_char (struct rust_demangler *rdm)
> > +{
> > + size_t hex_len;
> > + uint64_t value;
> > +
> > + hex_len = parse_hex_nibbles (rdm, &value);
> > +
> > + if (hex_len == 0 || hex_len > 8)
> > + {
> > + rdm->errored = 1;
> > + return;
> > + }
> > +
> > + /* Match Rust's character "debug" output as best as we can. */
> > + PRINT ("'");
> > + if (value == '\t')
> > + PRINT ("\\t");
> > + else if (value == '\r')
> > + PRINT ("\\r");
> > + else if (value == '\n')
> > + PRINT ("\\n");
> > + else if (value > ' ' && value < '~')
> > + /* Rust also considers many non-ASCII codepoints to be printable, but
> > + that logic is not easily ported to C. */
> > + print_str (rdm, (char *) &value, 1);
>
> * rust-demangle.c (demangle_const_char): Properly print the
> character value.
Ok for trunk/11.2/10.4 .
Jakub