[6/6] sim: mips: add printf attribute to trace func

Message ID 20210615051141.4801-6-vapier@gentoo.org
State New
Headers show
Series
  • [1/6] sim: mips: fix format warnings when setting up memory
Related show

Commit Message

Eli Zaretskii via Gdb-patches June 15, 2021, 5:11 a.m.
This helps catch format errors in code, although they're all clean
at this point already.
---
 sim/mips/interp.c   | 2 +-
 sim/mips/sim-main.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.31.1

Patch

diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index fc7b00324ffb..64e6d28dd52f 100644
--- a/sim/mips/interp.c
+++ b/sim/mips/interp.c
@@ -1722,7 +1722,7 @@  dotrace (SIM_DESC sd,
 	 int type,
 	 SIM_ADDR address,
 	 int width,
-	 char *comment,...)
+	 const char *comment, ...)
 {
   if (STATE & simTRACE) {
     va_list ap;
diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h
index 8c9abfa0b0b3..990573996bb9 100644
--- a/sim/mips/sim-main.h
+++ b/sim/mips/sim-main.h
@@ -965,7 +965,7 @@  address_word micromips_instruction_decode (SIM_DESC sd, sim_cpu * cpu,
 					   int instruction_size);
 
 #if WITH_TRACE_ANY_P
-void dotrace (SIM_DESC sd, sim_cpu *cpu, FILE *tracefh, int type, SIM_ADDR address, int width, char *comment, ...);
+void dotrace (SIM_DESC sd, sim_cpu *cpu, FILE *tracefh, int type, SIM_ADDR address, int width, const char *comment, ...) ATTRIBUTE_PRINTF (7, 8);
 extern FILE *tracefh;
 #else
 #define dotrace(sd, cpu, tracefh, type, address, width, comment, ...)