[binutils-gdb] sim: cgen: tweak cgen_rtx_error to fix warnings

Michael Frysinger vapier@sourceware.org
Sat May 8 16:27:54 GMT 2021


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

commit 6ae9091ab051a64a50678190a9c8f4d92b70933a
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sat May 1 22:05:25 2021 -0400

    sim: cgen: tweak cgen_rtx_error to fix warnings
    
    The function was missing a prototype, and passing a constant string
    as the format string instead of going through a %s format.

Diff:
---
 sim/common/ChangeLog    | 5 +++++
 sim/common/cgen-ops.h   | 2 ++
 sim/common/cgen-utils.c | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 0795a701c01..a3f6f38d7df 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,8 @@
+2021-05-08  Mike Frysinger  <vapier@gentoo.org>
+
+	* cgen-ops.h (cgen_rtx_error): Declare.
+	* cgen-utils.c (cgen_rtx_error): Add %s printf argument.
+
 2021-05-08  Mike Frysinger  <vapier@gentoo.org>
 
 	* cgen-utils.c (virtual_insn_entries): Change {0} to {}.
diff --git a/sim/common/cgen-ops.h b/sim/common/cgen-ops.h
index 329d7de285a..86a483528a3 100644
--- a/sim/common/cgen-ops.h
+++ b/sim/common/cgen-ops.h
@@ -708,4 +708,6 @@ BI SUBOFDI (DI a, DI b, BI c);
 
 #endif
 
+extern void cgen_rtx_error (SIM_CPU *, const char *);
+
 #endif /* CGEN_SEM_OPS_H */
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index a22caabbbd8..a430427bf12 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -416,7 +416,7 @@ cgen_rtx_error (SIM_CPU *cpu, const char * msg)
 {
   SIM_DESC sd = CPU_STATE (cpu);
 
-  sim_io_printf (sd, msg);
+  sim_io_printf (sd, "%s", msg);
   sim_io_printf (sd, "\n");
 
   sim_engine_halt (sd, cpu, NULL, CPU_PC_GET (cpu), sim_stopped, SIM_SIGTRAP);


More information about the Gdb-cvs mailing list