[binutils-gdb] sim: split sim/callback.h include out

Michael Frysinger vapier@sourceware.org
Thu Jun 17 04:11:59 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ef5058ae8714d68c0f671726618e721681523ac5

commit ef5058ae8714d68c0f671726618e721681523ac5
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sun Jun 13 22:14:40 2021 -0400

    sim: split sim/callback.h include out
    
    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.

Diff:
---
 sim/common/ChangeLog     | 9 +++++++++
 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/ChangeLog       | 4 ++++
 sim/cris/traps.c         | 1 +
 sim/frv/ChangeLog        | 4 ++++
 sim/frv/traps.c          | 1 +
 sim/h8300/ChangeLog      | 4 ++++
 sim/h8300/compile.c      | 1 +
 sim/m68hc11/ChangeLog    | 4 ++++
 sim/m68hc11/sim-main.h   | 1 -
 19 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 60b94cf06eb..abb2ec67995 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,12 @@
+2021-06-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* cgen-trace.c: Include sim/callback.h.
+	* nrun.c, sim-hw.c, sim-io.c, sim-syscall.c, sim-trace.c: Likewise.
+	* sim-basics.h: Delete sim/callback.h include.
+	* sim-endian.h: Include bfd.h.
+	* sim-syscall.h (struct cb_syscall): New forward decl.
+	* sim-utils.h (sim_analyze_program): Likewise.
+
 2021-06-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* Make-common.in (CONFIG_CFLAGS): Change @DEFS@ to -DHAVE_CONFIG_H.
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 66250c09be7..206720ca139 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 e39a0c6ed54..ba293d1ce73 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 ac63aef456a..13547422d3c 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 6e9101fa3f0..7b663a3375c 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 95d95042ded..9a3db171d1b 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 b5e874bef79..e09a4af7ba2 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 0f7601cafd7..be3ff8f82e2 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 6f79d9dfce9..562f443cb99 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 b8224e0b834..2c3798933db 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 9cc19f5567b..bfc8ac72d08 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/ChangeLog b/sim/cris/ChangeLog
index 60a5ce1c94e..24084199f73 100644
--- a/sim/cris/ChangeLog
+++ b/sim/cris/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* traps.c: Include sim/callback.h.
+
 2021-06-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure: Regenerate.
diff --git a/sim/cris/traps.c b/sim/cris/traps.c
index a55f7dfb992..2ad408139d8 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/ChangeLog b/sim/frv/ChangeLog
index f5038cbf1f3..80b33cd6d8e 100644
--- a/sim/frv/ChangeLog
+++ b/sim/frv/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* traps.c: Include sim/callback.h.
+
 2021-06-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure: Regenerate.
diff --git a/sim/frv/traps.c b/sim/frv/traps.c
index d5cab249622..91b424fc7e1 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/ChangeLog b/sim/h8300/ChangeLog
index 1d506ffc419..e12242ccd3b 100644
--- a/sim/h8300/ChangeLog
+++ b/sim/h8300/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* compile.c: Include sim/callback.h.
+
 2021-06-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure: Regenerate.
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 01e9766790c..8b13326a0a9 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/ChangeLog b/sim/m68hc11/ChangeLog
index 5b757d067d9..0c1aa1146e8 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* sim-main.h: Delete sim/callback.h include.
+
 2021-06-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure: Regenerate.
diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h
index 955c69fb38d..18a7426011b 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"


More information about the Gdb-cvs mailing list