public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: gdb-patches@sourceware.org
Cc: Mike Frysinger <vapier@gentoo.org>, Sam James <sam@gentoo.org>,
	Mark Wielaard <mark@klomp.org>
Subject: [PATCH] sim: mn10300: minimize mn10300-sim.h include in sim-main.h
Date: Sun, 15 Jan 2023 21:20:09 +0100	[thread overview]
Message-ID: <20230115202009.149626-1-mark@klomp.org> (raw)

sim-main.h is special since it is one of the files automatically
included in igen generated files. But this means anything including
sim-main.h might get everything included just for the igen files.

To prevent clashing symbols/defines only include mn10300-sim.h
from sim-main.h if it is included from one of the generated
igen C files. Add explicit includes of mn10300-sim.h to dv-mn103cpu.c,
interp.c and op_utils.c.
---
 sim/mn10300/dv-mn103cpu.c | 2 ++
 sim/mn10300/interp.c      | 2 ++
 sim/mn10300/op_utils.c    | 1 +
 sim/mn10300/sim-main.h    | 7 +++++++
 4 files changed, 12 insertions(+)

diff --git a/sim/mn10300/dv-mn103cpu.c b/sim/mn10300/dv-mn103cpu.c
index ad8669d3efa..b1ef68c80bb 100644
--- a/sim/mn10300/dv-mn103cpu.c
+++ b/sim/mn10300/dv-mn103cpu.c
@@ -24,6 +24,8 @@
 #include "sim-main.h"
 #include "hw-main.h"
 
+#include "mn10300-sim.h"
+
 /* DEVICE
 
    
diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c
index 07c3b8c900f..21e6d2e63a8 100644
--- a/sim/mn10300/interp.c
+++ b/sim/mn10300/interp.c
@@ -9,6 +9,8 @@
 #include "sim-assert.h"
 #include "sim-signal.h"
 
+#include "mn10300-sim.h"
+
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/sim/mn10300/op_utils.c b/sim/mn10300/op_utils.c
index b29b803d8e7..0c0a5db7f39 100644
--- a/sim/mn10300/op_utils.c
+++ b/sim/mn10300/op_utils.c
@@ -16,6 +16,7 @@
 #include "sim-signal.h"
 #include "sim-syscall.h"
 
+#include "mn10300-sim.h"
 
 #define REG0(X) ((X) & 0x3)
 #define REG1(X) (((X) & 0xc) >> 2)
diff --git a/sim/mn10300/sim-main.h b/sim/mn10300/sim-main.h
index 2187e794adb..8f0fa9760df 100644
--- a/sim/mn10300/sim-main.h
+++ b/sim/mn10300/sim-main.h
@@ -38,7 +38,14 @@ mn10300_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), (TRANSFER),
 #include "sim-fpu.h"
 #include "sim-signal.h"
 
+/* These datastructures and defines are only used by the igen generated
+   support.c, semantics.c, idecode.c and engine.c files.  */
+#if defined(SUPPORT_C) \
+    || defined(SEMANTICS_C) \
+    || defined(IDECODE_C) \
+    || defined(ENGINE_C)
 #include "mn10300-sim.h"
+#endif
 
 extern SIM_CORE_SIGNAL_FN mn10300_core_signal;
 
-- 
2.31.1


             reply	other threads:[~2023-01-15 20:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-15 20:20 Mark Wielaard [this message]
2023-01-15 21:47 ` Mike Frysinger
2023-01-18 21:53   ` Mark Wielaard
2023-01-19  0:01     ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230115202009.149626-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=gdb-patches@sourceware.org \
    --cc=sam@gentoo.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).