#include cleanliness
PATCH 1/1 #include cleanliness
My mother always told me to explicitly #include any headers need to compile a file, instead of relying on other #includes to bring them in. This patch fixes up targphys.h and cpu-common.h in this regard.
--- cpu-common.h | 4 ++++ targphys.h | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-)
cpu-common.h +4 -0
@@ -18,6 +18,10 @@#include "bswap.h" #include "qemu-queue.h" +#include "qemu-common.h" + +#include <stdbool.h> +#if !defined(CONFIG_USER_ONLY ) enum device_endian {
targphys.h +2 -0
@@ -3,6 +3,8 @@#ifndef TARGPHYS_H #define TARGPHYS_H +#include <stdint.h> +#ifdef TARGET_PHYS_ADDR_BITS /* target_phys_addr_t is the type of a physical address (its size can be different from 'target_ulong'). */
Signature · 1 line
1.7.5.1
Quoted 3 lines · Avi Kivity
My mother always told me to explicitly #include any headers need to compile a file, instead of relying on other #includes to bring them in. This patch fixes up
targphys.handcpu-common.hin this regard.
Can some qemu maintainer review this patch? Stefan?
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 15 lines · Avi Kivity
My mother always told me to explicitly #include any headers need to compile a file, instead of relying on other #includes to bring them in. This patch fixes up
targphys.handcpu-common.hin this regard.Signed-off-by Avi Kivity<[email protected]>--- cpu-common.h | 4 ++++ targphys.h | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-)cpu-common.h +0
-0
cpu-common.h line 23
Quoted 6 lines
cpu-common.h +3
-0@@ -18,6 +18,10 @@#include "bswap.h" #include "qemu-queue.h" +#include "qemu-common.h" + +#include <stdbool.h>
qemu-common.h should include stdbool.
The idea behind qemu-common.h is to avoid direct includes to help with portability.
Regards,
Anthony Liguori
Quoted 17 lines
cpu-common.h +1
-0+#if !defined(CONFIG_USER_ONLY ) enum device_endian {targphys.h +2
-0@@ -3,6 +3,8 @@#ifndef TARGPHYS_H #define TARGPHYS_H +#include <stdint.h> +#ifdef TARGET_PHYS_ADDR_BITS /* target_phys_addr_t is the type of a physical address (its size can be different from 'target_ulong'). */
Quoted 19 lines · Anthony Liguori
Quoted 18 lines · Avi Kivity
My mother always told me to explicitly #include any headers need to compile a file, instead of relying on other #includes to bring them in. This patch fixes up
targphys.handcpu-common.hin this regard.Signed-off-by Avi Kivity<[email protected]>--- cpu-common.h | 4 ++++ targphys.h | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-)cpu-common.h +0
-0@@ -18,6 +18,10 @@#include "bswap.h" #include "qemu-queue.h"
Quoted 7 lines
cpu-common.h
Quoted 3 lines
cpu-common.h +3
-0+#include "qemu-common.h" + +#include <stdbool.h>
qemu-common.hshould include stdbool.The idea behind
qemu-common.his to avoid direct includes to help with portability.
Okay. But note qemu-common.h #includes cpu.h #includes qemu-common.h...
I think osdep.h matches the "help with portability" label better, no?
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 28 lines · Avi Kivity
Quoted 27 lines · Anthony Liguori
Quoted 17 lines · Avi Kivity
My mother always told me to explicitly #include any headers need to compile
a file, instead of relying on other #includes to bring them in. This patch
fixes uptargphys.handcpu-common.hin this regard.Signed-off-by Avi Kivity<[email protected]>---
cpu-common.h| 4 ++++targphys.h| 2 ++2 files changed, 6 insertions(+), 0 deletions(-)cpu-common.h +0
-0cpu-common.h line 23
Quoted 6 lines
cpu-common.h +3
-0@@ -18,6 +18,10 @@#include "bswap.h" #include "qemu-queue.h" +#include "qemu-common.h" + +#include <stdbool.h>
qemu-common.hshould include stdbool.
Quoted 4 lines
Quoted 2 lines
The idea behind
qemu-common.his to avoid direct includes to help with portability.Okay. But note
qemu-common.h#includescpu.h#includesqemu-common.h...
Fortunately, guards will prevent infinite recursion here :-)
Quoted 1 line
I think
osdep.hmatches the "help with portability" label better, no?
I don't disagree, but that's not the purpose of osdep.h today. qemu-common.h is a header file that's more or less supposed to be included by everything.
It should prevent explicit #include's for system headers.
Regards,
Anthony Liguori