aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-06-26 23:11:48 -0400
committerMike Frysinger <vapier@gentoo.org>2021-06-27 10:49:38 -0400
commit5db3a175cc173c00607db959cfa401d0055f7dd4 (patch)
tree913b34ad1abb56c331cbaa7ff0100b1b85c9e150 /sim/common
parentb69bd9e723db53ce95c6ebb911d623b8f396b6ac (diff)
downloadgdb-5db3a175cc173c00607db959cfa401d0055f7dd4.zip
gdb-5db3a175cc173c00607db959cfa401d0055f7dd4.tar.gz
gdb-5db3a175cc173c00607db959cfa401d0055f7dd4.tar.bz2
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.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog6
-rw-r--r--sim/common/cgen-trace.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 8472b2b..56c7dc6 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,11 @@
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.
2021-06-27 Mike Frysinger <vapier@gentoo.org>
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 6592740..f5483fd 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -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 ();