On Tue, 2020-01-28 at 11:13 +0100, Jakub Jelinek wrote: > On Fri, Jan 24, 2020 at 07:53:28PM -0500, David Malcolm wrote: > > This patch fixes various build failures seen with gcc 4.4 > > > > gcc prior to 4.6 complains about: > > > > error: #pragma GCC diagnostic not allowed inside functions > > > > for various uses of PUSH_IGNORE_WFORMAT and POP_IGNORE_WFORMAT. > > This patch makes them a no-op with such compilers. > > I think this is wrong. > All that is really needed is make sure you #include "diagnostic- > core.h" > before including pretty-print.h. By including > diagnostic-core.h first, you do: > #ifndef GCC_DIAG_STYLE > #define GCC_DIAG_STYLE __gcc_tdiag__ > #endif > and then pretty-print.h will do: > #ifdef GCC_DIAG_STYLE > #define GCC_PPDIAG_STYLE GCC_DIAG_STYLE > #else > #define GCC_PPDIAG_STYLE __gcc_diag__ > #endif > If instead pretty-print.h is included first, then it will use > __gcc_diag__ > instead of __gcc_tdiag__ and thus will assume %E/%D etc. can't be > handled. > > I've so far just tested that in stage3 with this patch analyzer > builds > without any -Wformat/-Wformat-extra-args warnings.
Aha! Thanks - that's much better. > Ok for trunk if it passes bootstrap/regtest? LGTM. Dave