Make header files compilable by itself to get two benefits:
- never have to worry about order of inclusion
- never have to figure out hidden dependencies in order to be
able to include a file
git-svn-id: svn://svn.valgrind.org/vex/trunk@2546 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/guest_amd64_defs.h b/priv/guest_amd64_defs.h
index 6ad81d2..f44c6f8 100644
--- a/priv/guest_amd64_defs.h
+++ b/priv/guest_amd64_defs.h
@@ -38,6 +38,10 @@
#ifndef __VEX_GUEST_AMD64_DEFS_H
#define __VEX_GUEST_AMD64_DEFS_H
+#include "libvex_basictypes.h"
+#include "libvex_emnote.h" // VexEmNote
+#include "libvex_guest_amd64.h" // VexGuestAMD64State
+#include "guest_generic_bb_to_IR.h" // DisResult
/*---------------------------------------------------------*/
/*--- amd64 to IR conversion ---*/
diff --git a/priv/guest_arm_defs.h b/priv/guest_arm_defs.h
index 14a4cb8..1325991 100644
--- a/priv/guest_arm_defs.h
+++ b/priv/guest_arm_defs.h
@@ -32,6 +32,8 @@
#ifndef __VEX_GUEST_ARM_DEFS_H
#define __VEX_GUEST_ARM_DEFS_H
+#include "libvex_basictypes.h"
+#include "guest_generic_bb_to_IR.h" // DisResult
/*---------------------------------------------------------*/
/*--- arm to IR conversion ---*/
diff --git a/priv/guest_generic_bb_to_IR.h b/priv/guest_generic_bb_to_IR.h
index 6f865c0..13cac1f 100644
--- a/priv/guest_generic_bb_to_IR.h
+++ b/priv/guest_generic_bb_to_IR.h
@@ -36,6 +36,9 @@
#ifndef __VEX_GUEST_GENERIC_BB_TO_IR_H
#define __VEX_GUEST_GENERIC_BB_TO_IR_H
+#include "libvex_basictypes.h"
+#include "libvex_ir.h" // IRJumpKind
+#include "libvex.h" // VexArch
/* This defines stuff needed by the guest insn disassemblers.
It's a bit circular; is imported by
diff --git a/priv/guest_mips_defs.h b/priv/guest_mips_defs.h
index afb4f90..8977f2e 100644
--- a/priv/guest_mips_defs.h
+++ b/priv/guest_mips_defs.h
@@ -33,6 +33,9 @@
#ifndef __VEX_GUEST_MIPS_DEFS_H
#define __VEX_GUEST_MIPS_DEFS_H
+#include "libvex_basictypes.h"
+#include "guest_generic_bb_to_IR.h" // DisResult
+
/*---------------------------------------------------------*/
/*--- mips to IR conversion ---*/
/*---------------------------------------------------------*/
diff --git a/priv/guest_ppc_defs.h b/priv/guest_ppc_defs.h
index 7433298..7ce6cf5 100644
--- a/priv/guest_ppc_defs.h
+++ b/priv/guest_ppc_defs.h
@@ -39,6 +39,10 @@
#ifndef __VEX_GUEST_PPC_DEFS_H
#define __VEX_GUEST_PPC_DEFS_H
+#include "libvex_basictypes.h"
+#include "libvex_guest_ppc32.h" // VexGuestPPC32State
+#include "libvex_guest_ppc64.h" // VexGuestPPC64State
+#include "guest_generic_bb_to_IR.h" // DisResult
/*---------------------------------------------------------*/
/*--- ppc to IR conversion ---*/
diff --git a/priv/guest_ppc_toIR.c b/priv/guest_ppc_toIR.c
index 2a76801..f7d8d0f 100644
--- a/priv/guest_ppc_toIR.c
+++ b/priv/guest_ppc_toIR.c
@@ -128,6 +128,7 @@
#include "libvex_basictypes.h"
#include "libvex_ir.h"
#include "libvex.h"
+#include "libvex_emnote.h"
#include "libvex_guest_ppc32.h"
#include "libvex_guest_ppc64.h"
diff --git a/priv/guest_s390_defs.h b/priv/guest_s390_defs.h
index cc13eb7..de59f95 100644
--- a/priv/guest_s390_defs.h
+++ b/priv/guest_s390_defs.h
@@ -34,8 +34,6 @@
#define __VEX_GUEST_S390_DEFS_H
#include "libvex_basictypes.h" // offsetof
-#include "libvex_ir.h" // IRSB (needed by bb_to_IR.h)
-#include "libvex.h" // VexArch (needed by bb_to_IR.h)
#include "guest_generic_bb_to_IR.h" // DisResult
#include "libvex_guest_s390x.h" // VexGuestS390XState
diff --git a/priv/guest_s390_toIR.c b/priv/guest_s390_toIR.c
index 4ea8bb8..09b09b3 100644
--- a/priv/guest_s390_toIR.c
+++ b/priv/guest_s390_toIR.c
@@ -34,7 +34,7 @@
#include "libvex_basictypes.h"
#include "libvex_ir.h"
-#include "libvex.h" /* needed for bb_to_IR.h */
+#include "libvex_emnote.h"
#include "libvex_s390x_common.h"
#include "main_util.h" /* vassert */
#include "main_globals.h" /* vex_traceflags */
diff --git a/priv/guest_x86_defs.h b/priv/guest_x86_defs.h
index 54c2a0f..d982612 100644
--- a/priv/guest_x86_defs.h
+++ b/priv/guest_x86_defs.h
@@ -38,6 +38,10 @@
#ifndef __VEX_GUEST_X86_DEFS_H
#define __VEX_GUEST_X86_DEFS_H
+#include "libvex_basictypes.h"
+#include "libvex_guest_x86.h" // VexGuestX86State
+#include "libvex_emnote.h" // VexEmNote
+#include "guest_generic_bb_to_IR.h" // DisResult
/*---------------------------------------------------------*/
/*--- x86 to IR conversion ---*/
diff --git a/priv/host_amd64_defs.h b/priv/host_amd64_defs.h
index ad13cfa..0b7cacc 100644
--- a/priv/host_amd64_defs.h
+++ b/priv/host_amd64_defs.h
@@ -36,6 +36,9 @@
#ifndef __VEX_HOST_AMD64_DEFS_H
#define __VEX_HOST_AMD64_DEFS_H
+#include "libvex_basictypes.h"
+#include "libvex.h" // VexArch
+#include "host_generic_regs.h" // HReg
/* --------- Registers. --------- */
diff --git a/priv/host_arm_defs.h b/priv/host_arm_defs.h
index 91a6757..bcd6aca 100644
--- a/priv/host_arm_defs.h
+++ b/priv/host_arm_defs.h
@@ -30,6 +30,10 @@
#ifndef __VEX_HOST_ARM_DEFS_H
#define __VEX_HOST_ARM_DEFS_H
+#include "libvex_basictypes.h"
+#include "libvex.h" // VexArch
+#include "host_generic_regs.h" // HReg
+
extern UInt arm_hwcaps;
diff --git a/priv/host_mips_defs.h b/priv/host_mips_defs.h
index 1431ff5..9c2278e 100644
--- a/priv/host_mips_defs.h
+++ b/priv/host_mips_defs.h
@@ -31,6 +31,10 @@
#ifndef __VEX_HOST_MIPS_DEFS_H
#define __VEX_HOST_MIPS_DEFS_H
+#include "libvex_basictypes.h"
+#include "libvex.h" // VexArch
+#include "host_generic_regs.h" // HReg
+
/* Num registers used for function calls */
#define MIPS_N_REGPARMS 4
diff --git a/priv/host_ppc_defs.h b/priv/host_ppc_defs.h
index 5be5c35..58ea3a7 100644
--- a/priv/host_ppc_defs.h
+++ b/priv/host_ppc_defs.h
@@ -36,6 +36,10 @@
#ifndef __VEX_HOST_PPC_DEFS_H
#define __VEX_HOST_PPC_DEFS_H
+#include "libvex_basictypes.h"
+#include "libvex.h" // VexArch
+#include "host_generic_regs.h" // HReg
+
/* Num registers used for function calls */
#define PPC_N_REGPARMS 8
diff --git a/priv/host_s390_defs.h b/priv/host_s390_defs.h
index 72275da..7ce0793 100644
--- a/priv/host_s390_defs.h
+++ b/priv/host_s390_defs.h
@@ -35,7 +35,6 @@
#include "libvex_basictypes.h" /* Bool */
#include "libvex.h" /* VexArchInfo */
-#include "main_util.h" /* needed for host_generic_regs.h */
#include "host_generic_regs.h" /* HReg */
/* --------- Registers --------- */
diff --git a/priv/host_x86_defs.h b/priv/host_x86_defs.h
index a5f281c..8194291 100644
--- a/priv/host_x86_defs.h
+++ b/priv/host_x86_defs.h
@@ -36,6 +36,9 @@
#ifndef __VEX_HOST_X86_DEFS_H
#define __VEX_HOST_X86_DEFS_H
+#include "libvex_basictypes.h"
+#include "libvex.h" // VexArch
+#include "host_generic_regs.h" // HReg
/* --------- Registers. --------- */
diff --git a/pub/libvex_emnote.h b/pub/libvex_emnote.h
index a817eb7..abcedc1 100644
--- a/pub/libvex_emnote.h
+++ b/pub/libvex_emnote.h
@@ -36,6 +36,7 @@
#ifndef __LIBVEX_EMNOTE_H
#define __LIBVEX_EMNOTE_H
+#include "libvex_basictypes.h"
/* VEX can sometimes generate code which returns to the dispatcher
with the guest state pointer set to VEX_TRC_JMP_EMWARN or
diff --git a/pub/libvex_guest_amd64.h b/pub/libvex_guest_amd64.h
index 9c12e88..b8fef94 100644
--- a/pub/libvex_guest_amd64.h
+++ b/pub/libvex_guest_amd64.h
@@ -37,7 +37,6 @@
#define __LIBVEX_PUB_GUEST_AMD64_H
#include "libvex_basictypes.h"
-#include "libvex_emnote.h"
/*---------------------------------------------------------------*/
diff --git a/pub/libvex_guest_arm.h b/pub/libvex_guest_arm.h
index a0d4924..e837666 100644
--- a/pub/libvex_guest_arm.h
+++ b/pub/libvex_guest_arm.h
@@ -32,7 +32,6 @@
#define __LIBVEX_PUB_GUEST_ARM_H
#include "libvex_basictypes.h"
-#include "libvex_emnote.h"
/*---------------------------------------------------------------*/
diff --git a/pub/libvex_guest_mips32.h b/pub/libvex_guest_mips32.h
index eac4657..02c87ea 100644
--- a/pub/libvex_guest_mips32.h
+++ b/pub/libvex_guest_mips32.h
@@ -32,7 +32,6 @@
#define __LIBVEX_PUB_GUEST_MIPS32_H
#include "libvex_basictypes.h"
-#include "libvex_emnote.h"
/*---------------------------------------------------------------*/
diff --git a/pub/libvex_guest_ppc32.h b/pub/libvex_guest_ppc32.h
index 3f615fe..c691017 100644
--- a/pub/libvex_guest_ppc32.h
+++ b/pub/libvex_guest_ppc32.h
@@ -37,7 +37,6 @@
#define __LIBVEX_PUB_GUEST_PPC32_H
#include "libvex_basictypes.h"
-#include "libvex_emnote.h"
/*---------------------------------------------------------------*/
diff --git a/pub/libvex_guest_ppc64.h b/pub/libvex_guest_ppc64.h
index 31c4b62..b05b5b1 100644
--- a/pub/libvex_guest_ppc64.h
+++ b/pub/libvex_guest_ppc64.h
@@ -37,7 +37,6 @@
#define __LIBVEX_PUB_GUEST_PPC64_H
#include "libvex_basictypes.h"
-#include "libvex_emnote.h"
/*
volatile == caller-saved (not preserved across function calls)
diff --git a/pub/libvex_guest_s390x.h b/pub/libvex_guest_s390x.h
index 5d121e1..ae86aa3 100644
--- a/pub/libvex_guest_s390x.h
+++ b/pub/libvex_guest_s390x.h
@@ -32,7 +32,6 @@
#define __LIBVEX_PUB_GUEST_S390X_H
#include "libvex_basictypes.h"
-#include "libvex_emnote.h"
/*------------------------------------------------------------*/
/*--- Vex's representation of the s390 CPU state. ---*/
diff --git a/pub/libvex_guest_x86.h b/pub/libvex_guest_x86.h
index 3dcbc57..d46d67b 100644
--- a/pub/libvex_guest_x86.h
+++ b/pub/libvex_guest_x86.h
@@ -37,7 +37,6 @@
#define __LIBVEX_PUB_GUEST_X86_H
#include "libvex_basictypes.h"
-#include "libvex_emnote.h"
/*---------------------------------------------------------------*/