[PATCH 1/3] sim: split sim/callback.h include out
Mike Frysinger
vapier@gentoo.org
Wed Jun 16 06:33:00 GMT 2021
The sim-basics.h is too big and includes too many things. This leads
to some arch's sim-main.h having circular loop issues with defs, and
makes it hard to separate out common objects from arch-specific defs.
By splitting up sim-basics.h and killing off sim-main.h, it'll make
it easier to separate out the two.
Start with splitting out sim/callback.h.
---
sim/common/cgen-trace.c | 1 +
sim/common/nrun.c | 1 +
sim/common/sim-basics.h | 1 -
sim/common/sim-endian.h | 1 +
sim/common/sim-hw.c | 1 +
sim/common/sim-io.c | 1 +
sim/common/sim-syscall.c | 1 +
sim/common/sim-syscall.h | 2 ++
sim/common/sim-trace.c | 1 +
sim/common/sim-utils.h | 1 +
sim/cris/traps.c | 1 +
sim/frv/traps.c | 1 +
sim/h8300/compile.c | 1 +
sim/m68hc11/sim-main.h | 1 -
14 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 66250c09be75..206720ca1395 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "bfd.h"
#include "sim-main.h"
#include "sim-fpu.h"
+#include "sim/callback.h"
#ifndef SIZE_INSTRUCTION
#define SIZE_INSTRUCTION 16
diff --git a/sim/common/nrun.c b/sim/common/nrun.c
index e39a0c6ed546..ba293d1ce736 100644
--- a/sim/common/nrun.c
+++ b/sim/common/nrun.c
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <string.h>
#include "sim-main.h"
+#include "sim/callback.h"
#include "bfd.h"
#include "environ.h"
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index ac63aef456ac..13547422d3c3 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -112,7 +112,6 @@ typedef enum {
/* Basic definitions - ordered so that nothing calls what comes after it. */
#include "ansidecl.h"
-#include "sim/callback.h"
#include "sim/sim.h"
#include "sim-config.h"
diff --git a/sim/common/sim-endian.h b/sim/common/sim-endian.h
index 6e9101fa3f02..7b663a3375ce 100644
--- a/sim/common/sim-endian.h
+++ b/sim/common/sim-endian.h
@@ -23,6 +23,7 @@
#ifndef SIM_ENDIAN_H
#define SIM_ENDIAN_H
+#include "bfd.h"
/* C byte conversion functions */
diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c
index 95d95042ded4..9a3db171d1b3 100644
--- a/sim/common/sim-hw.c
+++ b/sim/common/sim-hw.c
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-main.h"
#include "sim-assert.h"
#include "sim-options.h"
+#include "sim/callback.h"
#include "sim-hw.h"
diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c
index b5e874bef794..e09a4af7ba2e 100644
--- a/sim/common/sim-io.c
+++ b/sim/common/sim-io.c
@@ -24,6 +24,7 @@
#include "sim-main.h"
#include "sim-io.h"
+#include "sim/callback.h"
#include "targ-vals.h"
#include <errno.h>
diff --git a/sim/common/sim-syscall.c b/sim/common/sim-syscall.c
index 0f7601cafd73..be3ff8f82e2c 100644
--- a/sim/common/sim-syscall.c
+++ b/sim/common/sim-syscall.c
@@ -24,6 +24,7 @@
#include "sim-main.h"
#include "sim-syscall.h"
+#include "sim/callback.h"
#include "targ-vals.h"
/* Read/write functions for system call interface. */
diff --git a/sim/common/sim-syscall.h b/sim/common/sim-syscall.h
index 6f79d9dfce96..562f443cb99a 100644
--- a/sim/common/sim-syscall.h
+++ b/sim/common/sim-syscall.h
@@ -20,6 +20,8 @@
#ifndef SIM_SYSCALL_H
#define SIM_SYSCALL_H
+struct cb_syscall;
+
/* Perform a syscall on the behalf of the target program. The error/result are
normalized into a single value (like a lot of operating systems do). If you
want the split values, see the other function below.
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
index b8224e0b8346..2c3798933db3 100644
--- a/sim/common/sim-trace.c
+++ b/sim/common/sim-trace.c
@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-io.h"
#include "sim-options.h"
#include "sim-fpu.h"
+#include "sim/callback.h"
#include "bfd.h"
#include "libiberty.h"
diff --git a/sim/common/sim-utils.h b/sim/common/sim-utils.h
index 9cc19f5567bc..bfc8ac72d08e 100644
--- a/sim/common/sim-utils.h
+++ b/sim/common/sim-utils.h
@@ -60,6 +60,7 @@ SIM_RC sim_analyze_program (SIM_DESC sd, const char *prog_name,
write the program sections at LMA interpreted as a virtual address.
This is still accommodated for backward compatibility reasons. */
+typedef struct host_callback_struct host_callback;
typedef int sim_write_fn (SIM_DESC sd, SIM_ADDR mem,
const unsigned char *buf, int length);
struct bfd *sim_load_file (SIM_DESC sd, const char *myname,
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index a55f7dfb9927..2ad408139d83 100644
--- a/sim/cris/traps.c
+++ b/sim/cris/traps.c
@@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sim-main.h"
#include "sim-syscall.h"
#include "sim-options.h"
+#include "sim/callback.h"
#include "bfd.h"
/* FIXME: get rid of targ-vals.h usage everywhere else. */
diff --git a/sim/frv/traps.c b/sim/frv/traps.c
index d5cab2496226..91b424fc7e1e 100644
--- a/sim/frv/traps.c
+++ b/sim/frv/traps.c
@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "cgen-engine.h"
#include "cgen-par.h"
#include "sim-fpu.h"
+#include "sim/callback.h"
#include "bfd.h"
#include "libiberty.h"
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 01e9766790c8..8b13326a0a9c 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -33,6 +33,7 @@
#include "sys/stat.h"
#include "sys/types.h"
#include "sim-options.h"
+#include "sim/callback.h"
#ifndef SIGTRAP
# define SIGTRAP 5
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
index 955c69fb38d4..18a7426011b0 100644
--- a/sim/m68hc11/sim-main.h
+++ b/sim/m68hc11/sim-main.h
@@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "opcode/m68hc11.h"
-#include "sim/callback.h"
#include "sim/sim.h"
#include "opcode/m68hc11.h"
#include "sim-types.h"
--
2.31.1
More information about the Gdb-patches
mailing list