sim: cgen: suppress trace non-literal printf warning
authorMike Frysinger <vapier@gentoo.org>
Sun, 27 Jun 2021 03:11:48 +0000 (23:11 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sun, 27 Jun 2021 14:49:38 +0000 (10:49 -0400)
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.

sim/common/ChangeLog
sim/common/cgen-trace.c

index 8472b2bdf12cae5beaffdb5a4275c01f2fc6aeaa..56c7dc666dc20d9d32d63b51475069867d1adbf2 100644 (file)
@@ -1,3 +1,9 @@
+2021-06-27  Mike Frysinger  <vapier@gentoo.org>
+
+       * cgen-trace.c: Include diagnostics.h.
+       (cgen_trace_extract): Call DIAGNOSTIC_PUSH,
+       DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL, and DIAGNOSTIC_POP.
+
 2021-06-27  Mike Frysinger  <vapier@gentoo.org>
 
        * cgen-run.c (engine_run_n): Assert cpu arguments are valid.
index 65927400ae3a5e4e85cab7bc8557992237c33a07..f5483fd39eaf57af110499bf5e31ffc31886c9c2 100644 (file)
@@ -22,6 +22,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <stdlib.h>
+#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 ();
This page took 0.029325 seconds and 4 git commands to generate.