Skip to contentSkip to conversation

Clean some includes and definitions

PATCH In review Stefan Weil 5 participants 22 messages Feb 2, 2012 – Feb 4, 2012

lore
Share & tools
lore
#0 lore raw

cover Clean some includes and definitions

Hi,

I tried to move the definition of HOST_LONG_BITS from configure to qemu-common.h. While doing this, I noticed that the different QEMU targets use includes in non-uniform ways.

So the simple goal resulted in quite a lot of patches.

Patch 1 simply removes a derived macro. This patch is independent of the others.

The next patches try to implement a more uniform include scheme for the TCG targets than today:

* cpu.h always starts with config.h and qemu-common.h.

* config.h is not needed before cpu.h

* qemu-common.h is not needed after cpu.h.

* Standard includes are not needed because they are already in qemu-common.h

This also avoids potential errors when qemu-common.h is included without a preceding config.h. Future code changes should be easier as soon as all targets use a uniform include scheme.

The last patch finally achieves my initial goal.

Regards,

Stefan Weil

[PATCH 01/15] Remove macro HOST_LONG_SIZE
[PATCH 02/15] target-alpha: Clean includes
[PATCH 03/15] target-arm: Clean includes
[PATCH 04/15] target-cris: Clean includes
[PATCH 05/15] target-i386: Clean includes
[PATCH 06/15] target-lm32: Clean includes
[PATCH 07/15] target-m68k: Clean includes
[PATCH 08/15] target-microblaze: Clean includes
[PATCH 09/15] target-mips: Clean includes
[PATCH 10/15] target-ppc: Clean includes
[PATCH 11/15] target-s390x: Clean includes
[PATCH 12/15] target-sh4: Clean includes
[PATCH 13/15] target-unicore32: Clean includes
[PATCH 14/15] target-xtensa: Clean includes
[PATCH 15/15] Move definition of HOST_LONG_BITS to qemu-common.h

#1 lore raw

PATCH 1/15 Remove macro HOST_LONG_SIZE

HOST_LONG_SIZE is simply the size of a pointer value. There is no need for this macro.

---
 cpu-defs.h |    2 --
 thunk.h    |    4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
cpu-defs.h +0 -2
index 57a709b..4527cbf 100644
@@ -60,8 +60,6 @@ typedef uint64_t target_ulong __attribute__((aligned(TARGET_LONG_ALIGNMENT)));
 #error TARGET_LONG_SIZE undefined
 #endif
 
-#define HOST_LONG_SIZE (HOST_LONG_BITS / 8)
-
 #define EXCP_INTERRUPT 	0x10000 /* async interruption */
 #define EXCP_HLT        0x10001 /* hlt instruction reached */
 #define EXCP_DEBUG      0x10002 /* cpu stopped after a breakpoint or singlestep */
thunk.h +2 -2
index 109c541..9810743 100644
@@ -99,7 +99,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
     case TYPE_PTRVOID:
     case TYPE_PTR:
         if (is_host) {
-            return HOST_LONG_SIZE;
+            return sizeof(void *);
         } else {
             return TARGET_ABI_BITS / 8;
         }
@@ -136,7 +136,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
     case TYPE_PTRVOID:
     case TYPE_PTR:
         if (is_host) {
-            return HOST_LONG_SIZE;
+            return sizeof(void *);
         } else {
             return TARGET_ABI_BITS / 8;
         }
Signature · 1 line
1.7.7.3
#2 lore raw

PATCH 2/15 target-alpha: Clean includes

In reply to Stefan Weil

The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.

Cc Richard Henderson <[email protected]>
---
 target-alpha/cpu.h       |    1 +
 target-alpha/translate.c |    5 -----
 2 files changed, 1 insertions(+), 5 deletions(-)
target-alpha/cpu.h +1 -0
index 9d61d45..5cd6fd8 100644
@@ -21,6 +21,7 @@
 #define __CPU_ALPHA_H__
 
 #include "config.h"
+#include "qemu-common.h"
 
 #define TARGET_LONG_BITS 64
 
target-alpha/translate.c +0 -5
index a961159..1d2142b 100644
@@ -17,15 +17,10 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdint.h>
-#include <stdlib.h>
-#include <stdio.h>
-
 #include "cpu.h"
 #include "disas.h"
 #include "host-utils.h"
 #include "tcg-op.h"
-#include "qemu-common.h"
 
 #include "helper.h"
 #define GEN_HELPER 1
Signature · 1 line
1.7.7.3
#3 lore raw

PATCH 3/15 target-arm: Clean includes

In reply to Stefan Weil

Remove some include statements which are not needed.

---
 target-arm/helper.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
target-arm/helper.c +0 -5
index ea4f35f..e9e2a27 100644
@@ -1,11 +1,6 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "cpu.h"
 #include "gdbstub.h"
 #include "helper.h"
-#include "qemu-common.h"
 #include "host-utils.h"
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/loader.h"
Signature · 1 line
1.7.7.3
Reviewed-by on v1 3/15
#4 lore raw

Re: [Qemu-devel] [PATCH 03/15] target-arm: Clean includes

Quoted 14 lines · Stefan Weil

Remove some include statements which are not needed.

---
 target-arm/helper.c |    5 -----

 1 files changed, 0 insertions(+), 5 deletions(-)
target-arm/helper.c +0 -1
index ea4f35f..e9e2a27 100644
@@ -1,11 +1,6 @@
-#include <stdio.h>

target-arm/helper.c line 6

Quoted 10 lines
target-arm/helper.c +0 -4
-#include <stdlib.h>
-#include <string.h>
-
  #include "cpu.h"
  #include "gdbstub.h"
  #include "helper.h"
-#include "qemu-common.h"
  #include "host-utils.h"
  #if !defined(CONFIG_USER_ONLY)
  #include "hw/loader.h"

-- PMM

#5 lore raw

PATCH 4/15 target-cris: Clean includes

In reply to Stefan Weil

The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.

Cc Edgar E. Iglesias <[email protected]>
---
 target-cris/cpu.h       |    3 +++
 target-cris/helper.c    |    4 ----
 target-cris/mmu.c       |    5 -----
 target-cris/translate.c |    7 -------
 4 files changed, 3 insertions(+), 16 deletions(-)
target-cris/cpu.h +3 -0
index 453afbb..222a062 100644
@@ -20,6 +20,9 @@
 #ifndef CPU_CRIS_H
 #define CPU_CRIS_H
 
+#include "config.h"
+#include "qemu-common.h"
+
 #define TARGET_LONG_BITS 32
 
 #define CPUState struct CPUCRISState
target-cris/helper.c +0 -4
index 5bc6d81..dd7f18e 100644
@@ -18,10 +18,6 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdio.h>
-#include <string.h>
-
-#include "config.h"
 #include "cpu.h"
 #include "mmu.h"
 #include "host-utils.h"
target-cris/mmu.c +0 -5
index d481e39..5cd8f27 100644
@@ -20,11 +20,6 @@
 
 #ifndef CONFIG_USER_ONLY
 
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "config.h"
 #include "cpu.h"
 #include "mmu.h"
 
target-cris/translate.c +0 -7
index 70abf8a..cbdc72c 100644
@@ -23,19 +23,12 @@
  * The condition code translation is in need of attention.
  */
 
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-
 #include "cpu.h"
 #include "disas.h"
 #include "tcg-op.h"
 #include "helper.h"
 #include "mmu.h"
 #include "crisv32-decode.h"
-#include "qemu-common.h"
 
 #define GEN_HELPER 1
 #include "helper.h"
Signature · 1 line
1.7.7.3
#6 lore raw

PATCH 5/15 target-i386: Clean includes

In reply to Stefan Weil

Remove some include statements which are not needed.

---
 target-i386/helper.c    |    6 ------
 target-i386/op_helper.c |    1 -
 2 files changed, 0 insertions(+), 7 deletions(-)
target-i386/helper.c +0 -6
index 2586aff..87c6a8f 100644
@@ -16,14 +16,8 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
 
 #include "cpu.h"
-#include "qemu-common.h"
 #include "kvm.h"
 #ifndef CONFIG_USER_ONLY
 #include "sysemu.h"
target-i386/op_helper.c +0 -1
index 1005b01..51a3b52 100644
@@ -22,7 +22,6 @@
 #include "dyngen-exec.h"
 #include "host-utils.h"
 #include "ioport.h"
-#include "qemu-common.h"
 #include "qemu-log.h"
 #include "cpu-defs.h"
 #include "helper.h"
Signature · 1 line
1.7.7.3
#7 lore raw

PATCH 6/15 target-lm32: Clean includes

In reply to Stefan Weil

config.h was missing in cpu.h.

---
 target-lm32/cpu.h       |    1 +
 target-lm32/helper.c    |    5 -----
 target-lm32/translate.c |    8 --------
 3 files changed, 1 insertions(+), 13 deletions(-)
target-lm32/cpu.h +1 -0
index 037ef52..b6b6b4c 100644
@@ -24,6 +24,7 @@
 
 #define CPUState struct CPULM32State
 
+#include "config.h"
 #include "qemu-common.h"
 #include "cpu-defs.h"
 struct CPULM32State;
target-lm32/helper.c +0 -5
index fc0b444..2637c03 100644
@@ -17,11 +17,6 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#include "config.h"
 #include "cpu.h"
 #include "host-utils.h"
 
target-lm32/translate.c +0 -8
index 0be105d..c80e48b 100644
@@ -17,18 +17,10 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-
 #include "cpu.h"
 #include "disas.h"
 #include "helper.h"
 #include "tcg-op.h"
-#include "qemu-common.h"
 
 #include "hw/lm32_pic.h"
 
Signature · 1 line
1.7.7.3
Acked-by on v1 6/15
#8 lore raw

Re: [Qemu-devel] [PATCH 06/15] target-lm32: Clean includes

Am Donnerstag 02 Februar 2012, 22:12:48 schrieb Stefan Weil:

Quoted 50 lines

config.h was missing in cpu.h.

---
 target-lm32/cpu.h       |    1 +
 target-lm32/helper.c    |    5 -----
 target-lm32/translate.c |    8 --------
 3 files changed, 1 insertions(+), 13 deletions(-)
target-lm32/cpu.h +1 -0
index 037ef52..b6b6b4c 100644
@@ -24,6 +24,7 @@
 
 #define CPUState struct CPULM32State
 
+#include "config.h"
 #include "qemu-common.h"
 #include "cpu-defs.h"
 struct CPULM32State;
target-lm32/helper.c +0 -0
index fc0b444..2637c03 100644
@@ -17,11 +17,6 @@
  * License along with this library; if not, see

<http://www.gnu.org/licenses/>. */

target-lm32/helper.c +0 -5
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#include "config.h"
 #include "cpu.h"
 #include "host-utils.h"
target-lm32/translate.c +0 -0
index 0be105d..c80e48b 100644
@@ -17,18 +17,10 @@
  * License along with this library; if not, see

<http://www.gnu.org/licenses/>. */

target-lm32/translate.c +0 -4
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>

target-lm32/translate.c line 25

Quoted 10 lines
target-lm32/translate.c +0 -4
-#include <inttypes.h>
-#include <assert.h>
-
 #include "cpu.h"
 #include "disas.h"
 #include "helper.h"
 #include "tcg-op.h"
-#include "qemu-common.h"
 
 #include "hw/lm32_pic.h"
Signature · 1 line
michael
#9 lore raw

PATCH 7/15 target-m68k: Clean includes

In reply to Stefan Weil

config.h was missing in cpu.h.

---
 target-m68k/cpu.h       |    1 +
 target-m68k/helper.c    |    5 -----
 target-m68k/translate.c |    6 ------
 3 files changed, 1 insertions(+), 11 deletions(-)
target-m68k/cpu.h +1 -0
index 0667f82..4cc3a35 100644
@@ -24,6 +24,7 @@
 
 #define CPUState struct CPUM68KState
 
+#include "config.h"
 #include "qemu-common.h"
 #include "cpu-defs.h"
 
target-m68k/helper.c +0 -5
index 674c8e6..fa675bf 100644
@@ -18,12 +18,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdio.h>
-#include <string.h>
-
-#include "config.h"
 #include "cpu.h"
-#include "qemu-common.h"
 #include "gdbstub.h"
 
 #include "helpers.h"
target-m68k/translate.c +0 -6
index 0e7f1fe..2bdd9dd 100644
@@ -17,13 +17,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
 
-#include "config.h"
 #include "cpu.h"
 #include "disas.h"
 #include "tcg-op.h"
Signature · 1 line
1.7.7.3
#10 lore raw

PATCH 8/15 target-microblaze: Clean includes

In reply to Stefan Weil

The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.

---
 target-microblaze/cpu.h       |    3 +++
 target-microblaze/helper.c    |    5 -----
 target-microblaze/mmu.c       |    4 ----
 target-microblaze/translate.c |    8 --------
 4 files changed, 3 insertions(+), 17 deletions(-)
target-microblaze/cpu.h +3 -0
index 3ecaeee..4092506 100644
@@ -19,6 +19,9 @@
 #ifndef CPU_MICROBLAZE_H
 #define CPU_MICROBLAZE_H
 
+#include "config.h"
+#include "qemu-common.h"
+
 #define TARGET_LONG_BITS 32
 
 #define CPUState struct CPUMBState
target-microblaze/helper.c +0 -5
index 2cf2802..e1355ff 100644
@@ -17,11 +17,6 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#include "config.h"
 #include "cpu.h"
 #include "host-utils.h"
 
target-microblaze/mmu.c +0 -4
index 281fc8d..7c34ac0 100644
@@ -16,11 +16,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
 
-#include "config.h"
 #include "cpu.h"
 
 #define D(x)
target-microblaze/translate.c +0 -8
index 96ce2ec..725c2dd 100644
@@ -17,19 +17,11 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-
 #include "cpu.h"
 #include "disas.h"
 #include "tcg-op.h"
 #include "helper.h"
 #include "microblaze-decode.h"
-#include "qemu-common.h"
 
 #define GEN_HELPER 1
 #include "helper.h"
Signature · 1 line
1.7.7.3
#11 lore raw

PATCH 9/15 target-mips: Clean includes

In reply to Stefan Weil

Remove some include statements which are not needed.

Cc Aurelien Jarno <[email protected]>
---
 target-mips/translate.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
target-mips/translate.c +0 -7
index d5b1c76..8361d88 100644
@@ -20,16 +20,9 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-
 #include "cpu.h"
 #include "disas.h"
 #include "tcg-op.h"
-#include "qemu-common.h"
 
 #include "helper.h"
 #define GEN_HELPER 1
Signature · 1 line
1.7.7.3
#12 lore raw

PATCH 10/15 target-ppc: Clean includes

In reply to Stefan Weil

Remove some include statements which are not needed.

Cc Alexander Graf <[email protected]>
---
 target-ppc/helper.c    |    6 ------
 target-ppc/translate.c |    6 ------
 2 files changed, 0 insertions(+), 12 deletions(-)
target-ppc/helper.c +0 -6
index 5847453..455dcc0 100644
@@ -16,15 +16,9 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
 
 #include "cpu.h"
 #include "helper_regs.h"
-#include "qemu-common.h"
 #include "kvm.h"
 #include "kvm_ppc.h"
 #include "cpus.h"
target-ppc/translate.c +0 -6
index 66eae30..74ad855 100644
@@ -17,16 +17,10 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
 
 #include "cpu.h"
 #include "disas.h"
 #include "tcg-op.h"
-#include "qemu-common.h"
 #include "host-utils.h"
 
 #include "helper.h"
Signature · 1 line
1.7.7.3
#13 lore raw

Re: [Qemu-devel] [PATCH 10/15] target-ppc: Clean includes

Quoted 1 line · Stefan Weil

Remove some include statements which are not needed.

Are these redundant or do they just happen to be unnecessary because of unused debug #ifdefs?

Alex

Quoted 52 lines
Cc Alexander Graf <[email protected]>

---

target-ppc/helper.c    |    6 ------
target-ppc/translate.c |    6 ------
2 files changed, 0 insertions(+), 12 deletions(-)
target-ppc/helper.c +0 -6
index 5847453..455dcc0 100644
@@ -16,15 +16,9 @@
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
 
 #include "cpu.h"
 #include "helper_regs.h"
-#include "qemu-common.h"
 #include "kvm.h"
 #include "kvm_ppc.h"
 #include "cpus.h"
target-ppc/translate.c +0 -6
index 66eae30..74ad855 100644
@@ -17,16 +17,10 @@
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
 
 #include "cpu.h"
 #include "disas.h"
 #include "tcg-op.h"
-#include "qemu-common.h"
 #include "host-utils.h"
 
 #include "helper.h"
Signature · 1 line
1.7.7.3
#14 lore raw

Re: [Qemu-devel] [PATCH 10/15] target-ppc: Clean includes

Am 02.02.2012 22:26, schrieb Alexander Graf:

Quoted 9 lines · Stefan Weil
Quoted 2 lines

Remove some include statements which are not needed.

Are these redundant or do they just happen to be unnecessary because of unused debug #ifdefs?

Alex

They are redundant because cpu.h includes qemu-common.h which includes the standard include files.

Cheers,
Stefan

#15 lore raw

Re: [Qemu-devel] [PATCH 10/15] target-ppc: Clean includes

Quoted 6 lines · Stefan Weil

Am 02.02.2012 22:26, schrieb Alexander Graf:

Quoted 5 lines · Stefan Weil
Quoted 2 lines

Remove some include statements which are not needed.

Quoted 7 lines
Quoted 4 lines

Are these redundant or do they just happen to be unnecessary because of unused debug #ifdefs?

Alex

They are redundant because cpu.h includes qemu-common.h which includes the standard include files.

Well, then:

Alex

#16 lore raw

PATCH 11/15 target-s390x: Clean includes

In reply to Stefan Weil

The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.

---
 target-s390x/cpu.h       |    3 +++
 target-s390x/helper.c    |    5 -----
 target-s390x/translate.c |    5 -----
 3 files changed, 3 insertions(+), 10 deletions(-)
target-s390x/cpu.h +3 -0
index b8893b3..e892bec 100644
@@ -19,6 +19,9 @@
 #ifndef CPU_S390X_H
 #define CPU_S390X_H
 
+#include "config.h"
+#include "qemu-common.h"
+
 #define TARGET_LONG_BITS 64
 
 #define ELF_MACHINE	EM_S390
target-s390x/helper.c +0 -5
index 10cc9dd..c0ec890 100644
@@ -18,13 +18,8 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "cpu.h"
 #include "gdbstub.h"
-#include "qemu-common.h"
 #include "qemu-timer.h"
 #ifndef CONFIG_USER_ONLY
 #include "sysemu.h"
target-s390x/translate.c +0 -5
index ee15672..71f9dcd 100644
@@ -17,11 +17,6 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
 
 /* #define DEBUG_ILLEGAL_INSTRUCTIONS */
 /* #define DEBUG_INLINE_BRANCHES */
Signature · 1 line
1.7.7.3
#17 lore raw

PATCH 12/15 target-sh4: Clean includes

In reply to Stefan Weil

Remove some include statements which are not needed.

Cc Aurelien Jarno <[email protected]>
---
 target-sh4/translate.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
target-sh4/translate.c +0 -6
index aacf96d..dd0ee4b 100644
@@ -16,11 +16,6 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
 
 #define DEBUG_DISAS
 #define SH4_DEBUG_DISAS
@@ -29,7 +24,6 @@
 #include "cpu.h"
 #include "disas.h"
 #include "tcg-op.h"
-#include "qemu-common.h"
 
 #include "helper.h"
 #define GEN_HELPER 1
Signature · 1 line
1.7.7.3
#18 lore raw

PATCH 13/15 target-unicore32: Clean includes

In reply to Stefan Weil

The change in cpu.h is needed when HOST_LONG_BITS is defined in qemu-common.h.

---
 target-unicore32/cpu.h    |    2 ++
 target-unicore32/helper.c |    4 ----
 2 files changed, 2 insertions(+), 4 deletions(-)
target-unicore32/cpu.h +2 -0
index b4e72cf..f725634 100644
@@ -20,6 +20,8 @@
 
 #define CPUState                struct CPUState_UniCore32
 
+#include "config.h"
+#include "qemu-common.h"
 #include "cpu-defs.h"
 #include "softfloat.h"
 
target-unicore32/helper.c +0 -4
index b5b1cb7..ee7f82b 100644
@@ -5,14 +5,10 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #include "cpu.h"
 #include "gdbstub.h"
 #include "helper.h"
-#include "qemu-common.h"
 #include "host-utils.h"
 
 static inline void set_feature(CPUState *env, int feature)
Signature · 1 line
1.7.7.3
#19 lore raw

PATCH 14/15 target-xtensa: Clean includes

In reply to Stefan Weil

Remove some include statements which are not needed.

---
 target-xtensa/core-dc232b.c |    1 -
 target-xtensa/core-fsf.c    |    1 -
 target-xtensa/helper.c      |    1 -
 3 files changed, 0 insertions(+), 3 deletions(-)
target-xtensa/core-dc232b.c +0 -1
index 4d9bd55..21b287d 100644
@@ -1,7 +1,6 @@
 #include "cpu.h"
 #include "exec-all.h"
 #include "gdbstub.h"
-#include "qemu-common.h"
 #include "host-utils.h"
 
 #include "core-dc232b/core-isa.h"
target-xtensa/core-fsf.c +0 -1
index 7650462..763b8e5 100644
@@ -1,7 +1,6 @@
 #include "cpu.h"
 #include "exec-all.h"
 #include "gdbstub.h"
-#include "qemu-common.h"
 #include "host-utils.h"
 
 #include "core-fsf/core-isa.h"
target-xtensa/helper.c +0 -1
index 2a0cb1a..1264c83 100644
@@ -28,7 +28,6 @@
 #include "cpu.h"
 #include "exec-all.h"
 #include "gdbstub.h"
-#include "qemu-common.h"
 #include "host-utils.h"
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/loader.h"
Signature · 1 line
1.7.7.3
#21 lore raw

PATCH 15/15 Move definition of HOST_LONG_BITS to qemu-common.h

In reply to Stefan Weil

Like the related macro TCG_TARGET_LONG, HOST_LONG_BITS can be determined by the C preprocessor. It is also not used in Makefiles.

So there is no need to calculate it in configure, and it can be defined in qemu-common.h.

---
 configure     |   12 ------------
 qemu-common.h |    9 +++++++++
 2 files changed, 9 insertions(+), 12 deletions(-)
configure +0 -12
index 3b0b300..6dec57d 100755
@@ -1266,17 +1266,6 @@ esac
 
 fi
 
-# host long bits test, actually a pointer size test
-cat > $TMPC << EOF
-int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
-EOF
-if compile_object; then
-hostlongbits=64
-else
-hostlongbits=32
-fi
-
-
 ##########################################
 # NPTL probe
 
@@ -2927,7 +2916,6 @@ fi
 if test "$bigendian" = "yes" ; then
   echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
 fi
-echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
 if test "$mingw32" = "yes" ; then
   echo "CONFIG_WIN32=y" >> $config_host_mak
   rc_version=`cat $source_path/VERSION`
qemu-common.h +9 -0
index 8b69a9e..bd0b1bd 100644
@@ -65,6 +65,15 @@ typedef struct Monitor Monitor;
 #define TIME_MAX LONG_MAX
 #endif
 
+/* HOST_LONG_BITS is the size of a native pointer in bits. */
+#if UINTPTR_MAX == UINT32_MAX
+# define HOST_LONG_BITS 32
+#elif UINTPTR_MAX == UINT64_MAX
+# define HOST_LONG_BITS 64
+#else
+# error Unknown pointer size
+#endif
+
 #ifndef CONFIG_IOVEC
 #define CONFIG_IOVEC
 struct iovec {
Signature · 1 line
1.7.7.3