[binutils-gdb] sim: mips: add printf attribute to trace func

Michael Frysinger vapier@sourceware.org
Wed Jun 16 05:57:16 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b80d4475804d5f3c4e9d996229e1569b7b3c8426

commit b80d4475804d5f3c4e9d996229e1569b7b3c8426
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Tue Jun 15 01:09:49 2021 -0400

    sim: mips: add printf attribute to trace func
    
    This helps catch format errors in code, although they're all clean
    at this point already.

Diff:
---
 sim/mips/ChangeLog  | 5 +++++
 sim/mips/interp.c   | 2 +-
 sim/mips/sim-main.h | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index c36e01fa19e..c582abc0744 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-16  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (dotrace): Make comment const.
+	* sim-main.h (dotrace):  Likewise.  Add ATTRIBUTE_PRINTF.
+
 2021-06-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* interp.c (sim_monitor): Change ap type to address_word*.
diff --git a/sim/mips/interp.c b/sim/mips/interp.c
index 5645f01ed22..a6f504acc76 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 8c9abfa0b0b..990573996bb 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, ...)


More information about the Gdb-cvs mailing list