[PATCH 4/4] sim: include ansidecl.h when needed

Mike Frysinger vapier@gentoo.org
Sun Dec 5 03:10:15 GMT 2021


Avoid implicit include deps with this to help untangle sim headers
so we can get rid of arch-specific sim-main.h.
---
 sim/common/cgen-trace.h  | 2 ++
 sim/common/genmloop.sh   | 1 +
 sim/common/hw-device.h   | 2 ++
 sim/common/hw-events.h   | 2 ++
 sim/common/hw-tree.h     | 2 ++
 sim/common/sim-basics.h  | 1 -
 sim/common/sim-engine.h  | 2 ++
 sim/common/sim-events.h  | 2 ++
 sim/common/sim-hw.h      | 2 ++
 sim/common/sim-inline.h  | 1 +
 sim/common/sim-io.h      | 2 ++
 sim/common/sim-profile.c | 2 ++
 sim/common/sim-syscall.c | 2 ++
 sim/common/sim-trace.c   | 1 +
 sim/common/sim-trace.h   | 1 +
 sim/common/sim-utils.h   | 2 ++
 16 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/sim/common/cgen-trace.h b/sim/common/cgen-trace.h
index c617e7e21e12..96048b906e20 100644
--- a/sim/common/cgen-trace.h
+++ b/sim/common/cgen-trace.h
@@ -20,6 +20,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef CGEN_TRACE_H
 #define CGEN_TRACE_H
 
+#include "ansidecl.h"
+
 void cgen_trace_insn_init (SIM_CPU *, int);
 void cgen_trace_insn_fini (SIM_CPU *, const struct argbuf *, int);
 void cgen_trace_insn (SIM_CPU *, const struct cgen_insn *,
diff --git a/sim/common/genmloop.sh b/sim/common/genmloop.sh
index e1eb08c1bdfd..63e01ec4d98c 100755
--- a/sim/common/genmloop.sh
+++ b/sim/common/genmloop.sh
@@ -312,6 +312,7 @@ cat << EOF
 #define WANT_CPU @cpu@
 #define WANT_CPU_@CPU@
 
+#include "ansidecl.h"
 #include "bfd.h"
 
 #include "sim-main.h"
diff --git a/sim/common/hw-device.h b/sim/common/hw-device.h
index a7e598bb40e9..711001d13c9a 100644
--- a/sim/common/hw-device.h
+++ b/sim/common/hw-device.h
@@ -25,6 +25,8 @@
 
 #include <stdarg.h>
 
+#include "ansidecl.h"
+
 /* Introduction:
 
    As explained in earlier sections, the device, device instance,
diff --git a/sim/common/hw-events.h b/sim/common/hw-events.h
index 7d750007c095..0b55542ad32a 100644
--- a/sim/common/hw-events.h
+++ b/sim/common/hw-events.h
@@ -22,6 +22,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stdarg.h>
 
+#include "ansidecl.h"
+
 /* Event manager customized for hardware models.
 
    This interface is discussed further in sim-events.h. */
diff --git a/sim/common/hw-tree.h b/sim/common/hw-tree.h
index 2f717ec8d9f4..07a95b4177dc 100644
--- a/sim/common/hw-tree.h
+++ b/sim/common/hw-tree.h
@@ -25,6 +25,8 @@
 
 #include <stdarg.h>
 
+#include "ansidecl.h"
+
 struct hw *hw_tree_create
 (SIM_DESC sd,
  const char *device);
diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h
index f09a4f267205..62d47e417261 100644
--- a/sim/common/sim-basics.h
+++ b/sim/common/sim-basics.h
@@ -111,7 +111,6 @@ typedef enum {
 
 /* Basic definitions - ordered so that nothing calls what comes after it.  */
 
-#include "ansidecl.h"
 #include "sim/sim.h"
 
 #include "sim-config.h"
diff --git a/sim/common/sim-engine.h b/sim/common/sim-engine.h
index 159d96bf119e..4d77856ef7e4 100644
--- a/sim/common/sim-engine.h
+++ b/sim/common/sim-engine.h
@@ -22,6 +22,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stdarg.h>
 
+#include "ansidecl.h"
+
 typedef struct _sim_engine sim_engine;
 struct _sim_engine
 {
diff --git a/sim/common/sim-events.h b/sim/common/sim-events.h
index 3c30d6489f8d..b102a959ede4 100644
--- a/sim/common/sim-events.h
+++ b/sim/common/sim-events.h
@@ -25,6 +25,8 @@
 
 #include <stdarg.h>
 
+#include "ansidecl.h"
+
 /* Notes:
 
    When scheduling an event, the a delta of zero/one refers to the
diff --git a/sim/common/sim-hw.h b/sim/common/sim-hw.h
index 71dc8378b1d4..0207aa3e5fc3 100644
--- a/sim/common/sim-hw.h
+++ b/sim/common/sim-hw.h
@@ -22,6 +22,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stdarg.h>
 
+#include "ansidecl.h"
+
 /* Parse a hardware definition */
 
 struct hw *sim_hw_parse
diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
index a397e58e10f2..216f30d2b638 100644
--- a/sim/common/sim-inline.h
+++ b/sim/common/sim-inline.h
@@ -23,6 +23,7 @@
 #ifndef SIM_INLINE_H
 #define SIM_INLINE_H
 
+#include "ansidecl.h"
 
 /* INLINE CODE SELECTION:
 
diff --git a/sim/common/sim-io.h b/sim/common/sim-io.h
index 2fc22f332ccc..c77b4f8189dc 100644
--- a/sim/common/sim-io.h
+++ b/sim/common/sim-io.h
@@ -28,6 +28,8 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include "ansidecl.h"
+
 /* See the file include/callbacks.h for a description */
 
 int sim_io_init (SIM_DESC sd);
diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c
index 393a0b733ed2..f4cdf40b05b1 100644
--- a/sim/common/sim-profile.c
+++ b/sim/common/sim-profile.c
@@ -25,6 +25,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdlib.h>
 #include <string.h>
 
+#include "ansidecl.h"
+
 #include "sim-main.h"
 #include "sim-io.h"
 #include "sim-options.h"
diff --git a/sim/common/sim-syscall.c b/sim/common/sim-syscall.c
index 1e83db2ae8a4..26f57f431bfb 100644
--- a/sim/common/sim-syscall.c
+++ b/sim/common/sim-syscall.c
@@ -22,6 +22,8 @@
 
 #include <errno.h>
 
+#include "ansidecl.h"
+
 #include "sim-main.h"
 #include "sim-syscall.h"
 #include "sim/callback.h"
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
index fbfa27fac6f4..15816100d561 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 <stdlib.h>
 #include <string.h>
 
+#include "ansidecl.h"
 #include "bfd.h"
 #include "dis-asm.h"
 #include "libiberty.h"
diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h
index f17bbc634209..09e900c9f571 100644
--- a/sim/common/sim-trace.h
+++ b/sim/common/sim-trace.h
@@ -24,6 +24,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stdarg.h>
 
+#include "ansidecl.h"
 #include "dis-asm.h"
 
 /* Standard traceable entities.  */
diff --git a/sim/common/sim-utils.h b/sim/common/sim-utils.h
index 1af4ea206b82..20ca9fcfe231 100644
--- a/sim/common/sim-utils.h
+++ b/sim/common/sim-utils.h
@@ -20,6 +20,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef SIM_UTILS_H
 #define SIM_UTILS_H
 
+#include "ansidecl.h"
+
 /* Memory management with an allocator that clears memory before use. */
 
 void *zalloc (unsigned long size);
-- 
2.33.0



More information about the Gdb-patches mailing list