public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/9] sim: cpu: fix SMP msg prefix helper
@ 2022-12-25  7:14 Mike Frysinger
  2022-12-25  7:14 ` [PATCH 2/9] sim: mn10300: fix SMP compile Mike Frysinger
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Mike Frysinger @ 2022-12-25  7:14 UTC (permalink / raw)
  To: gdb-patches

This code fails to compile when SMP is enabled due to some obvious
errors.  Fix those and change the logic to avoid CPP to prevent any
future rot from creeping back in.
---
 sim/common/sim-utils.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index 259b14cce295..d4a624c3b6ff 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -123,14 +123,17 @@ sim_cpu_lookup (SIM_DESC sd, const char *cpu_name)
 const char *
 sim_cpu_msg_prefix (sim_cpu *cpu)
 {
-#if MAX_NR_PROCESSORS == 1
-  return "";
-#else
   static char *prefix;
 
+  if (MAX_NR_PROCESSORS == 1)
+    return "";
+
   if (prefix == NULL)
     {
+      SIM_DESC sd = CPU_STATE (cpu);
       int maxlen = 0;
+      int i;
+
       for (i = 0; i < MAX_NR_PROCESSORS; ++i)
 	{
 	  int len = strlen (CPU_NAME (STATE_CPU (sd, i)));
@@ -140,8 +143,8 @@ sim_cpu_msg_prefix (sim_cpu *cpu)
       prefix = (char *) xmalloc (maxlen + 5);
     }
   sprintf (prefix, "%s: ", CPU_NAME (cpu));
+
   return prefix;
-#endif
 }
 
 /* Cover fn to sim_io_eprintf.  */
-- 
2.39.0


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

end of thread, other threads:[~2022-12-25  7:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-25  7:14 [PATCH 1/9] sim: cpu: fix SMP msg prefix helper Mike Frysinger
2022-12-25  7:14 ` [PATCH 2/9] sim: mn10300: fix SMP compile Mike Frysinger
2022-12-25  7:14 ` [PATCH 3/9] sim: or1k: fix iterator typo when setting up cpus Mike Frysinger
2022-12-25  7:14 ` [PATCH 4/9] sim: v850: fix SMP compile Mike Frysinger
2022-12-25  7:14 ` [PATCH 5/9] sim: m32r: fix iterator typo when setting up cpus Mike Frysinger
2022-12-25  7:14 ` [PATCH 6/9] sim: msp430: add basic SMP cpu init Mike Frysinger
2022-12-25  7:14 ` [PATCH 7/9] sim: cpu: change default init to handle all cpus Mike Frysinger
2022-12-25  7:14 ` [PATCH 8/9] sim: smp: make option available again Mike Frysinger
2022-12-25  7:14 ` [PATCH 9/9] sim: smp: plumb igen flag down to all users 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).