On Thu, 2024-03-07 at 09:30 +0100, Jakub Jelinek wrote:
> Hi!
> 
> I'm seeing warnings like
> ../../gcc/analyzer/access-diagram.cc: In member function ‘void
> ana::bit_size_expr::print(pretty_printer*) const’:
> ../../gcc/analyzer/access-diagram.cc:399:26: warning: unknown
> conversion type character ‘E’ in format [-Wformat=]
>   399 |         pp_printf (pp, _("%qE bytes"), bytes_expr);
>       |                          ^~~~~~~~~~~
> when building stage2/stage3 gcc.  While such warnings would be
> understandable when building stage1 because one could e.g. have some
> older host compiler which doesn't understand some of the format
> specifiers,
> the above seems to be because we have in pretty-print.h
> #ifdef GCC_DIAG_STYLE
> #define GCC_PPDIAG_STYLE GCC_DIAG_STYLE
> #else
> #define GCC_PPDIAG_STYLE __gcc_diag__
> #endif
> and use GCC_PPDIAG_STYLE e.g. for pp_printf, and while
> diagnostic-core.h has
> #ifndef GCC_DIAG_STYLE
> #define GCC_DIAG_STYLE __gcc_tdiag__
> #endif
> (and similarly various FE headers include their own GCC_DIAG_STYLE)
> when including pretty-print.h before diagnostic-core.h we end up
> with __gcc_diag__ style rather than __gcc_tdiag__ style, which I
> think
> is the right thing for the analyzer, because analyzer seems to use
> default_tree_printer everywhere:
> grep pp_format_decoder.*=.default_tree_printer analyzer/* | wc -l
> 57
> 
> The following patch fixes that by making sure diagnostic-core.h is
> included
> before pretty-print.h.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Yes, thanks
Dave

Reply via email to