public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH/committed 1/4] sim: m68hc11: include stdlib.h for prototypes
@ 2021-01-30 18:40 Mike Frysinger
  2021-01-30 18:40 ` [PATCH/committed 2/4] sim: m68hc11: tweak printf-style funcs Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mike Frysinger @ 2021-01-30 18:40 UTC (permalink / raw)
  To: gdb-patches

These files use abort() & strtod(), so include stdlib.h for them.
---
 sim/m68hc11/ChangeLog     | 4 ++++
 sim/m68hc11/dv-m68hc11.c  | 1 +
 sim/m68hc11/m68hc11_sim.c | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index eb1dea331798..90d73df898a7 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-m68hc11.c, m68hc11_sim.c: Include stdlib.h.
+
 2021-01-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.ac (SIM_AC_OPTION_HARDWARE): Inline variables.
diff --git a/sim/m68hc11/dv-m68hc11.c b/sim/m68hc11/dv-m68hc11.c
index 7fae3ed3137b..3ec524a8e07d 100644
--- a/sim/m68hc11/dv-m68hc11.c
+++ b/sim/m68hc11/dv-m68hc11.c
@@ -25,6 +25,7 @@
 #include "sim-options.h"
 #include "hw-base.h"
 #include <limits.h>
+#include <stdlib.h>
 
 /* DEVICE
 
diff --git a/sim/m68hc11/m68hc11_sim.c b/sim/m68hc11/m68hc11_sim.c
index 517ba17153aa..8eaa421a68fc 100644
--- a/sim/m68hc11/m68hc11_sim.c
+++ b/sim/m68hc11/m68hc11_sim.c
@@ -22,6 +22,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "sim-module.h"
 #include "sim-options.h"
 
+#include <stdlib.h>
+
 enum {
   OPTION_CPU_RESET = OPTION_START,
   OPTION_EMUL_OS,
-- 
2.30.0


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

* [PATCH/committed 2/4] sim: m68hc11: tweak printf-style funcs
  2021-01-30 18:40 [PATCH/committed 1/4] sim: m68hc11: include stdlib.h for prototypes Mike Frysinger
@ 2021-01-30 18:40 ` Mike Frysinger
  2021-01-30 18:40 ` [PATCH/committed 3/4] sim: m68hc11: localize a few functions Mike Frysinger
  2021-01-30 18:40 ` [PATCH/committed 4/4] sim: m68hc11: fix printf size warnings Mike Frysinger
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2021-01-30 18:40 UTC (permalink / raw)
  To: gdb-patches

GCC complains that we past non-string literals to a printf style func,
so put a %s in here to keep it quiet.
---
 sim/m68hc11/ChangeLog | 4 ++++
 sim/m68hc11/interp.c  | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 90d73df898a7..7c956d1b6278 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (sim_get_info, sim_board_reset): Pass %s to sim_hw_parse.
+
 2021-01-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* dv-m68hc11.c, m68hc11_sim.c: Include stdlib.h.
diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c
index 26f2d1527beb..7dc8e25c0462 100644
--- a/sim/m68hc11/interp.c
+++ b/sim/m68hc11/interp.c
@@ -100,7 +100,7 @@ sim_get_info (SIM_DESC sd, char *cmd)
 	  sim_io_eprintf (sd, "Valid devices: cpu timer sio eeprom\n");
 	  return;
 	}
-      hw_dev = sim_hw_parse (sd, dev_list[i].device);
+      hw_dev = sim_hw_parse (sd, "%s", dev_list[i].device);
       if (hw_dev == 0)
 	{
 	  sim_io_eprintf (sd, "Device '%s' not found\n", dev_list[i].device);
@@ -138,7 +138,7 @@ sim_board_reset (SIM_DESC sd)
       cpu_type = "/m68hc12";
     }
   
-  hw_cpu = sim_hw_parse (sd, cpu_type);
+  hw_cpu = sim_hw_parse (sd, "%s", cpu_type);
   if (hw_cpu == 0)
     {
       sim_io_eprintf (sd, "%s cpu not found in device tree.", cpu_type);
-- 
2.30.0


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

* [PATCH/committed 3/4] sim: m68hc11: localize a few functions
  2021-01-30 18:40 [PATCH/committed 1/4] sim: m68hc11: include stdlib.h for prototypes Mike Frysinger
  2021-01-30 18:40 ` [PATCH/committed 2/4] sim: m68hc11: tweak printf-style funcs Mike Frysinger
@ 2021-01-30 18:40 ` Mike Frysinger
  2021-01-30 18:40 ` [PATCH/committed 4/4] sim: m68hc11: fix printf size warnings Mike Frysinger
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2021-01-30 18:40 UTC (permalink / raw)
  To: gdb-patches

These are only used in this file and lack prototypes, so gcc
complains about it.  Add static everywhere to clean that up.
---
 sim/m68hc11/ChangeLog     |  6 ++++++
 sim/m68hc11/m68hc11_sim.c | 12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 7c956d1b6278..e83e11ebb70b 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,9 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+	* m68hc11_sim.c (cpu_set_sp): Add static markings.
+	(cpu_get_reg, cpu_get_src_reg, cpu_set_dst_reg,
+	cpu_get_indexed_operand_addr, cpu_get_indexed_operand8): Likewise.
+
 2021-01-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* interp.c (sim_get_info, sim_board_reset): Pass %s to sim_hw_parse.
diff --git a/sim/m68hc11/m68hc11_sim.c b/sim/m68hc11/m68hc11_sim.c
index 8eaa421a68fc..0d7860170bc7 100644
--- a/sim/m68hc11/m68hc11_sim.c
+++ b/sim/m68hc11/m68hc11_sim.c
@@ -115,7 +115,7 @@ cpu_set_sp (sim_cpu *cpu, uint16 val)
   cpu->cpu_regs.sp = val;
 }
 
-uint16
+static uint16
 cpu_get_reg (sim_cpu *cpu, uint8 reg)
 {
   switch (reg)
@@ -137,7 +137,7 @@ cpu_get_reg (sim_cpu *cpu, uint8 reg)
     }
 }
 
-uint16
+static uint16
 cpu_get_src_reg (sim_cpu *cpu, uint8 reg)
 {
   switch (reg)
@@ -171,7 +171,7 @@ cpu_get_src_reg (sim_cpu *cpu, uint8 reg)
     }
 }
 
-void
+static void
 cpu_set_dst_reg (sim_cpu *cpu, uint8 reg, uint16 val)
 {
   switch (reg)
@@ -213,7 +213,7 @@ cpu_set_dst_reg (sim_cpu *cpu, uint8 reg, uint16 val)
     }
 }
 
-void
+static void
 cpu_set_reg (sim_cpu *cpu, uint8 reg, uint16 val)
 {
   switch (reg)
@@ -346,7 +346,7 @@ cpu_get_indexed_operand_addr (sim_cpu *cpu, int restricted)
   return addr;
 }
 
-uint8
+static uint8
 cpu_get_indexed_operand8 (sim_cpu *cpu, int restricted)
 {
   uint16 addr;
@@ -355,7 +355,7 @@ cpu_get_indexed_operand8 (sim_cpu *cpu, int restricted)
   return memory_read8 (cpu, addr);
 }
 
-uint16
+static uint16
 cpu_get_indexed_operand16 (sim_cpu *cpu, int restricted)
 {
   uint16 addr;
-- 
2.30.0


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

* [PATCH/committed 4/4] sim: m68hc11: fix printf size warnings
  2021-01-30 18:40 [PATCH/committed 1/4] sim: m68hc11: include stdlib.h for prototypes Mike Frysinger
  2021-01-30 18:40 ` [PATCH/committed 2/4] sim: m68hc11: tweak printf-style funcs Mike Frysinger
  2021-01-30 18:40 ` [PATCH/committed 3/4] sim: m68hc11: localize a few functions Mike Frysinger
@ 2021-01-30 18:40 ` Mike Frysinger
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2021-01-30 18:40 UTC (permalink / raw)
  To: gdb-patches

GCC complains %llu is wrong for signed64, so switch to PRIi64.
---
 sim/m68hc11/ChangeLog       | 4 ++++
 sim/m68hc11/dv-m68hc11tim.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index e83e11ebb70b..0063e8e8b464 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-30  Mike Frysinger  <vapier@gentoo.org>
+
+	* dv-m68hc11tim.c (cycle_to_string): Change llu to PRIi64.
+
 2021-01-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* m68hc11_sim.c (cpu_set_sp): Add static markings.
diff --git a/sim/m68hc11/dv-m68hc11tim.c b/sim/m68hc11/dv-m68hc11tim.c
index b0d032e19ae5..cd8274ffc34f 100644
--- a/sim/m68hc11/dv-m68hc11tim.c
+++ b/sim/m68hc11/dv-m68hc11tim.c
@@ -503,7 +503,7 @@ cycle_to_string (sim_cpu *cpu, signed64 t, int flags)
   if (t < LONG_MAX)
     sprintf (buf, "%9lu%s%s", (unsigned long) t, cycle_buf, time_buf);
   else
-    sprintf (buf, "%llu%s%s", t, cycle_buf, time_buf);
+    sprintf (buf, "%" PRIi64 "%s%s", t, cycle_buf, time_buf);
   return buf;
 }
 
-- 
2.30.0


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

end of thread, other threads:[~2021-01-30 18:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-30 18:40 [PATCH/committed 1/4] sim: m68hc11: include stdlib.h for prototypes Mike Frysinger
2021-01-30 18:40 ` [PATCH/committed 2/4] sim: m68hc11: tweak printf-style funcs Mike Frysinger
2021-01-30 18:40 ` [PATCH/committed 3/4] sim: m68hc11: localize a few functions Mike Frysinger
2021-01-30 18:40 ` [PATCH/committed 4/4] sim: m68hc11: fix printf size warnings 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).