* [PATCH] sim: mn10300: minimize mn10300-sim.h include in sim-main.h @ 2023-01-15 20:20 Mark Wielaard 2023-01-15 21:47 ` Mike Frysinger 0 siblings, 1 reply; 4+ messages in thread From: Mark Wielaard @ 2023-01-15 20:20 UTC (permalink / raw) To: gdb-patches; +Cc: Mike Frysinger, Sam James, Mark Wielaard 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sim: mn10300: minimize mn10300-sim.h include in sim-main.h 2023-01-15 20:20 [PATCH] sim: mn10300: minimize mn10300-sim.h include in sim-main.h Mark Wielaard @ 2023-01-15 21:47 ` Mike Frysinger 2023-01-18 21:53 ` Mark Wielaard 0 siblings, 1 reply; 4+ messages in thread From: Mike Frysinger @ 2023-01-15 21:47 UTC (permalink / raw) To: Mark Wielaard; +Cc: gdb-patches, Sam James [-- Attachment #1: Type: text/plain, Size: 660 bytes --] On 15 Jan 2023 21:20, Mark Wielaard wrote: > --- 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 a nifty hack. can you move the sim-fpu.h & sim-signal.h inside this block ? -mike [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sim: mn10300: minimize mn10300-sim.h include in sim-main.h 2023-01-15 21:47 ` Mike Frysinger @ 2023-01-18 21:53 ` Mark Wielaard 2023-01-19 0:01 ` Mike Frysinger 0 siblings, 1 reply; 4+ messages in thread From: Mark Wielaard @ 2023-01-18 21:53 UTC (permalink / raw) To: Mike Frysinger; +Cc: gdb-patches, Sam James [-- Attachment #1: Type: text/plain, Size: 987 bytes --] Hi Mike, On Sun, Jan 15, 2023 at 04:47:44PM -0500, Mike Frysinger wrote: > On 15 Jan 2023 21:20, Mark Wielaard wrote: > > --- 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 > > a nifty hack. can you move the sim-fpu.h & sim-signal.h inside this > block ? Sure. That does mean sim/mn10300/{dv-mn103cpu.c,interp.c,op_utils.c} need to also explicitly include one or both of these files. But I guess that these explicit includes are the intention. See attached. OK to push like that? Thanks, Mark [-- Attachment #2: 0001-sim-mn10300-minimize-mn10300-sim.h-include-in-sim-ma.patch --] [-- Type: text/plain, Size: 2736 bytes --] From eaaae057bf321dcf2d0c994c1a8fb0cd32e50518 Mon Sep 17 00:00:00 2001 From: Mark Wielaard <mark@klomp.org> Date: Sun, 15 Jan 2023 20:24:06 +0100 Subject: [PATCH] sim: mn10300: minimize mn10300-sim.h include in sim-main.h 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 sim-fpu.h, sim-signal.h, 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, sim-fpu.h and/or sim-signal.h to dv-mn103cpu.c, interp.c and op_utils.c. --- sim/mn10300/dv-mn103cpu.c | 4 ++++ sim/mn10300/interp.c | 3 +++ sim/mn10300/op_utils.c | 2 ++ sim/mn10300/sim-main.h | 8 ++++++++ 4 files changed, 17 insertions(+) diff --git a/sim/mn10300/dv-mn103cpu.c b/sim/mn10300/dv-mn103cpu.c index ad8669d3efa..55bbe253a63 100644 --- a/sim/mn10300/dv-mn103cpu.c +++ b/sim/mn10300/dv-mn103cpu.c @@ -22,8 +22,12 @@ #include "defs.h" #include "sim-main.h" +#include "sim-fpu.h" +#include "sim-signal.h" #include "hw-main.h" +#include "mn10300-sim.h" + /* DEVICE diff --git a/sim/mn10300/interp.c b/sim/mn10300/interp.c index 07c3b8c900f..91b742c7276 100644 --- a/sim/mn10300/interp.c +++ b/sim/mn10300/interp.c @@ -7,8 +7,11 @@ #include "bfd.h" #include "sim-assert.h" +#include "sim-fpu.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 7e035f43259..5425537dc1d 100644 --- a/sim/mn10300/op_utils.c +++ b/sim/mn10300/op_utils.c @@ -11,9 +11,11 @@ #include "sim/callback.h" #include "sim-main.h" +#include "sim-fpu.h" #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..d08b13dc531 100644 --- a/sim/mn10300/sim-main.h +++ b/sim/mn10300/sim-main.h @@ -34,11 +34,19 @@ mn10300_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), (TRANSFER), /** * TODO: Move these includes to the igen files that need them. * This requires extending the igen syntax to support header includes. + * + * For now only include them in 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 "sim-fpu.h" #include "sim-signal.h" #include "mn10300-sim.h" +#endif extern SIM_CORE_SIGNAL_FN mn10300_core_signal; -- 2.31.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sim: mn10300: minimize mn10300-sim.h include in sim-main.h 2023-01-18 21:53 ` Mark Wielaard @ 2023-01-19 0:01 ` Mike Frysinger 0 siblings, 0 replies; 4+ messages in thread From: Mike Frysinger @ 2023-01-19 0:01 UTC (permalink / raw) To: Mark Wielaard; +Cc: gdb-patches, Sam James [-- Attachment #1: Type: text/plain, Size: 1146 bytes --] On 18 Jan 2023 22:53, Mark Wielaard wrote: > On Sun, Jan 15, 2023 at 04:47:44PM -0500, Mike Frysinger wrote: > > On 15 Jan 2023 21:20, Mark Wielaard wrote: > > > --- 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 > > > > a nifty hack. can you move the sim-fpu.h & sim-signal.h inside this > > block ? > > Sure. That does mean sim/mn10300/{dv-mn103cpu.c,interp.c,op_utils.c} > need to also explicitly include one or both of these files. But I > guess that these explicit includes are the intention. yes, that's the direction we want to go > See attached. OK to push like that? lgtm, thanks -mike [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-19 0:01 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-01-15 20:20 [PATCH] sim: mn10300: minimize mn10300-sim.h include in sim-main.h Mark Wielaard 2023-01-15 21:47 ` Mike Frysinger 2023-01-18 21:53 ` Mark Wielaard 2023-01-19 0:01 ` 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).