On Thu, Mar 04, 2021 at 09:08:35AM +0100, Richard Biener wrote:
> 2021-03-04  Richard Biener  <rguent...@suse.de>
> 
>       PR middle-end/97855
>       * tree-pretty-print.c: Poison pp_printf.
>       (dump_decl_name): Avoid use of pp_printf.
>       (dump_block_node): Likewise.
>       (dump_generic_node): Likewise.

>         char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
> +       pp_character (pp, c);
> +       pp_character (pp, uid_sep);
>         if (flags & TDF_NOUID)
> -         pp_printf (pp, "%c.xxxx", c);
> +         pp_string (pp, "xxxx");
>         else
> -         pp_printf (pp, "%c%c%u", c, uid_sep, DECL_UID (node));
> +         pp_decimal_int (pp, (int) DECL_UID (node));

I think it would be better if this patch didn't change behavior.
So yes, pp_decimal_int is ok for previous %d or %i, but %u
should be done with
pp_scalar (pp, "%u", DECL_UID (node));
(or pp_unsigned_wide_integer (pp, DECL_UID (node));).

>       }
>      }
>    if ((flags & TDF_ALIAS) && DECL_PT_UID (node) != DECL_UID (node))
>      {
>        if (flags & TDF_NOUID)
> -     pp_printf (pp, "ptD.xxxx");
> +     pp_string (pp, "ptD.xxxx");
>        else
> -     pp_printf (pp, "ptD.%u", DECL_PT_UID (node));
> +     {
> +       pp_string (pp, "ptD.");
> +       pp_decimal_int (pp, (int) DECL_PT_UID (node));

Ditto here, pp_scalar (pp, "%u", DECL_PT_UID (node));

> @@ -2165,9 +2207,16 @@ dump_generic_node (pretty_printer *pp, tree node, int 
> spc, dump_flags_t flags,
>         else
>           {
>             if (flags & TDF_GIMPLE)
> -             pp_printf (pp, "<D%u>", DECL_UID (node));
> +             {
> +               pp_character (pp, 'D');
> +               pp_decimal_int (pp, (int) DECL_UID (node));

Here too.
> +             }
>             else
> -             pp_printf (pp, "<D.%u>", DECL_UID (node));
> +             {
> +               pp_string (pp, "<D.");
> +               pp_decimal_int (pp, (int) DECL_UID (node));

And here.
> +               pp_character (pp, '>');
> +             }
>           }
>       }
>        break;
> @@ -3021,9 +3070,12 @@ dump_generic_node (pretty_printer *pp, tree node, int 
> spc, dump_flags_t flags,
>         pp_string (pp, ", ivdep");
>         break;
>       case annot_expr_unroll_kind:
> -       pp_printf (pp, ", unroll %d",
> -                  (int) TREE_INT_CST_LOW (TREE_OPERAND (node, 2)));
> -       break;
> +       {
> +         pp_string (pp, ", unroll ");
> +         pp_decimal_int (pp,
> +                         (int) TREE_INT_CST_LOW (TREE_OPERAND (node, 2)));
> +         break;
> +       }
>       case annot_expr_no_vector_kind:
>         pp_string (pp, ", no-vector");
>         break;
> @@ -3205,7 +3257,8 @@ dump_generic_node (pretty_printer *pp, tree node, int 
> spc, dump_flags_t flags,
>        dump_generic_node (pp, CHREC_LEFT (node), spc, flags, false);
>        pp_string (pp, ", +, ");
>        dump_generic_node (pp, CHREC_RIGHT (node), spc, flags, false);
> -      pp_printf (pp, "}_%u", CHREC_VARIABLE (node));
> +      pp_string (pp, "}_");
> +      pp_decimal_int (pp, (int)CHREC_VARIABLE (node));

And here.

Ok with those changes if it passes testing.

        Jakub

Reply via email to