From: Mike Frysinger Date: Sun, 27 Jun 2021 03:11:48 +0000 (-0400) Subject: sim: cgen: suppress trace non-literal printf warning X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5db3a175cc173c00607db959cfa401d0055f7dd4;p=binutils-gdb.git sim: cgen: suppress trace non-literal printf warning The cgen trace macros are a bit ugly in that they specify a series of format strings & arguments in a single call. This means we pass a non-literal string to printf and the compiler warns about it. Use the diagnostic macros to suppress that in this one place. --- diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 8472b2bdf12..56c7dc666dc 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,9 @@ +2021-06-27 Mike Frysinger + + * cgen-trace.c: Include diagnostics.h. + (cgen_trace_extract): Call DIAGNOSTIC_PUSH, + DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL, and DIAGNOSTIC_POP. + 2021-06-27 Mike Frysinger * cgen-run.c (engine_run_n): Assert cpu arguments are valid. diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c index 65927400ae3..f5483fd39ea 100644 --- a/sim/common/cgen-trace.c +++ b/sim/common/cgen-trace.c @@ -22,6 +22,7 @@ along with this program. If not, see . */ #include #include +#include "diagnostics.h" #include "dis-asm.h" #include "bfd.h" #include "sim-main.h" @@ -211,7 +212,10 @@ cgen_trace_extract (SIM_CPU *cpu, IADDR pc, const char *name, ...) { case 'x' : ival = va_arg (args, int); + DIAGNOSTIC_PUSH + DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL trace_printf (CPU_STATE (cpu), cpu, fmt, ival); + DIAGNOSTIC_POP break; default : abort ();