public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/4] sim: cgen: tweak initializers to avoid warnings
@ 2021-05-05  2:07 Mike Frysinger
  2021-05-05  2:07 ` [PATCH 2/4] sim: cgen: tweak cgen_rtx_error to fix warnings Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mike Frysinger @ 2021-05-05  2:07 UTC (permalink / raw)
  To: gdb-patches

Use {} instead of {0} to avoid warnings:

common/cgen-utils.c:59:1: warning: missing braces around initializer [-Wmissing-braces]
   59 | {
      | ^
   60 |   {
   61 |     VIRTUAL_INSN_X_INVALID, "--invalid--", NULL, 0, { V, { 0 } }
      |                                                            {{}}

Generated code should be the same.
---
 sim/common/cgen-utils.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index 3d7c2821eaa2..a22caabbbd8e 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -56,22 +56,22 @@ const char * const mode_names[] = {
 static const CGEN_IBASE virtual_insn_entries[] =
 {
   {
-    VIRTUAL_INSN_X_INVALID, "--invalid--", NULL, 0, { V, { 0 } }
+    VIRTUAL_INSN_X_INVALID, "--invalid--", NULL, 0, { V, {} }
   },
   {
-    VIRTUAL_INSN_X_BEFORE, "--before--", NULL, 0, { V, { 0 } }
+    VIRTUAL_INSN_X_BEFORE, "--before--", NULL, 0, { V, {} }
   },
   {
-    VIRTUAL_INSN_X_AFTER, "--after--", NULL, 0, { V, { 0 } }
+    VIRTUAL_INSN_X_AFTER, "--after--", NULL, 0, { V, {} }
   },
   {
-    VIRTUAL_INSN_X_BEGIN, "--begin--", NULL, 0, { V, { 0 } }
+    VIRTUAL_INSN_X_BEGIN, "--begin--", NULL, 0, { V, {} }
   },
   {
-    VIRTUAL_INSN_X_CHAIN, "--chain--", NULL, 0, { V, { 0 } }
+    VIRTUAL_INSN_X_CHAIN, "--chain--", NULL, 0, { V, {} }
   },
   {
-    VIRTUAL_INSN_X_CTI_CHAIN, "--cti-chain--", NULL, 0, { V, { 0 } }
+    VIRTUAL_INSN_X_CTI_CHAIN, "--cti-chain--", NULL, 0, { V, {} }
   }
 };
 
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/4] sim: cgen: tweak cgen_rtx_error to fix warnings
  2021-05-05  2:07 [PATCH 1/4] sim: cgen: tweak initializers to avoid warnings Mike Frysinger
@ 2021-05-05  2:07 ` Mike Frysinger
  2021-05-05  2:07 ` [PATCH 3/4] sim: cgen: namespace mode_names a bit Mike Frysinger
  2021-05-05  2:07 ` [PATCH 4/4] sim: cgen: tweak trace format Mike Frysinger
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2021-05-05  2:07 UTC (permalink / raw)
  To: gdb-patches

The function was missing a prototype, and passing a constant string
as the format string instead of going through a %s format.
---
 sim/common/cgen-ops.h   | 2 ++
 sim/common/cgen-utils.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/sim/common/cgen-ops.h b/sim/common/cgen-ops.h
index 329d7de285af..86a483528a33 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 a22caabbbd8e..a430427bf12a 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);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/4] sim: cgen: namespace mode_names a bit
  2021-05-05  2:07 [PATCH 1/4] sim: cgen: tweak initializers to avoid warnings Mike Frysinger
  2021-05-05  2:07 ` [PATCH 2/4] sim: cgen: tweak cgen_rtx_error to fix warnings Mike Frysinger
@ 2021-05-05  2:07 ` Mike Frysinger
  2021-05-05  2:07 ` [PATCH 4/4] sim: cgen: tweak trace format Mike Frysinger
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2021-05-05  2:07 UTC (permalink / raw)
  To: gdb-patches

These are exported in the library linkage, so add a cgen_ prefix.
---
 sim/common/cgen-types.h | 4 ++--
 sim/common/cgen-utils.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sim/common/cgen-types.h b/sim/common/cgen-types.h
index 6a2351431141..c002876803c7 100644
--- a/sim/common/cgen-types.h
+++ b/sim/common/cgen-types.h
@@ -56,8 +56,8 @@ typedef enum mode_type {
 #define MAX_TARGET_MODES ((int) MODE_TARGET_MAX)
 #define MAX_MODES ((int) MODE_MAX)
 
-extern const char * const mode_names[];
-#define MODE_NAME(m) (mode_names[m])
+extern const char * const cgen_mode_names[];
+#define MODE_NAME(m) (cgen_mode_names[m])
 
 typedef void VOID;
 typedef unsigned char BI;
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index a430427bf12a..602abcba1820 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -28,7 +28,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #define SEMOPS_DEFINE_INLINE
 #include "cgen-ops.h"
 
-const char * const mode_names[] = {
+const char * const cgen_mode_names[] = {
   "VOID",
   "BI",
   "QI",
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 4/4] sim: cgen: tweak trace format
  2021-05-05  2:07 [PATCH 1/4] sim: cgen: tweak initializers to avoid warnings Mike Frysinger
  2021-05-05  2:07 ` [PATCH 2/4] sim: cgen: tweak cgen_rtx_error to fix warnings Mike Frysinger
  2021-05-05  2:07 ` [PATCH 3/4] sim: cgen: namespace mode_names a bit Mike Frysinger
@ 2021-05-05  2:07 ` Mike Frysinger
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2021-05-05  2:07 UTC (permalink / raw)
  To: gdb-patches

---
 sim/common/cgen-trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 649c37a61b1c..ea0399fdb6e2 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -384,7 +384,7 @@ sim_cgen_disassemble_insn (SIM_CPU *cpu, const CGEN_INSN *insn,
 
   if (length != insn_length)
   {
-    sim_io_error (sd, "unable to read address %x", pc);
+    sim_io_error (sd, "unable to read address %" PRIxTA, pc);
   }
 
   /* If the entire insn will fit into an integer, then do it. Otherwise, just
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-05  2:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05  2:07 [PATCH 1/4] sim: cgen: tweak initializers to avoid warnings Mike Frysinger
2021-05-05  2:07 ` [PATCH 2/4] sim: cgen: tweak cgen_rtx_error to fix warnings Mike Frysinger
2021-05-05  2:07 ` [PATCH 3/4] sim: cgen: namespace mode_names a bit Mike Frysinger
2021-05-05  2:07 ` [PATCH 4/4] sim: cgen: tweak trace format Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).