[PATCH 07/10] include: Clean up includes

Peter Maydell posted 10 patches 10 months ago
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Christoph Muellner <christoph.muellner@vrull.eu>, LIU Zhiwei <zhiwei_liu@linux.alibaba.com>, Philipp Tomsich <philipp.tomsich@vrull.eu>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <Alistair.Francis@wdc.com>, "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Jonathan Cameron <jonathan.cameron@huawei.com>, Fan Ni <fan.ni@samsung.com>, "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Michael S. Tsirkin" <mst@redhat.com>, Laurent Vivier <laurent@vivier.eu>, David Hildenbrand <david@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Xiao Guangrong <xiaoguangrong.eric@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony Perard <anthony.perard@citrix.com>, Paul Durrant <paul@xen.org>, Ilya Maximets <i.maximets@ovn.org>, Jason Wang <jasowang@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liwei1518@gmail.com>, Thomas Huth <thuth@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>
There is a newer version of this series
[PATCH 07/10] include: Clean up includes
Posted by Peter Maydell 10 months ago
This commit was created with scripts/clean-includes:
 ./scripts/clean-includes --git include include/*/*.h include/*/*/*.h

All .c should include qemu/osdep.h first.  The script performs three
related cleanups:

* Ensure .c files include qemu/osdep.h first.
* Including it in a .h is redundant, since the .c  already includes
  it.  Drop such inclusions.
* Likewise, including headers qemu/osdep.h includes is redundant.
  Drop these, too.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I hand-checked that all these headers are included only by .c
files which already have osdep.h included.
---
 include/hw/arm/raspberrypi-fw-defs.h | 1 -
 include/hw/mem/memory-device.h       | 1 -
 include/hw/ppc/spapr_nested.h        | 1 -
 include/hw/xen/xen-hvm-common.h      | 1 -
 include/qemu/qtree.h                 | 1 -
 include/ui/rect.h                    | 2 --
 6 files changed, 7 deletions(-)

diff --git a/include/hw/arm/raspberrypi-fw-defs.h b/include/hw/arm/raspberrypi-fw-defs.h
index 4551fe7450d..579cf0d5546 100644
--- a/include/hw/arm/raspberrypi-fw-defs.h
+++ b/include/hw/arm/raspberrypi-fw-defs.h
@@ -10,7 +10,6 @@
 #ifndef INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_
 #define INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_
 
-#include "qemu/osdep.h"
 
 enum rpi_firmware_property_tag {
     RPI_FWREQ_PROPERTY_END =                           0,
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index a1d62cc551a..e0571c8a319 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -14,7 +14,6 @@
 #define MEMORY_DEVICE_H
 
 #include "hw/qdev-core.h"
-#include "qemu/typedefs.h"
 #include "qapi/qapi-types-machine.h"
 #include "qom/object.h"
 
diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h
index d3834864764..d312a5d61da 100644
--- a/include/hw/ppc/spapr_nested.h
+++ b/include/hw/ppc/spapr_nested.h
@@ -1,7 +1,6 @@
 #ifndef HW_SPAPR_NESTED_H
 #define HW_SPAPR_NESTED_H
 
-#include "qemu/osdep.h"
 #include "target/ppc/cpu.h"
 
 /*
diff --git a/include/hw/xen/xen-hvm-common.h b/include/hw/xen/xen-hvm-common.h
index 4e9904f1a65..4b1d728f35c 100644
--- a/include/hw/xen/xen-hvm-common.h
+++ b/include/hw/xen/xen-hvm-common.h
@@ -1,7 +1,6 @@
 #ifndef HW_XEN_HVM_COMMON_H
 #define HW_XEN_HVM_COMMON_H
 
-#include "qemu/osdep.h"
 #include "qemu/units.h"
 
 #include "cpu.h"
diff --git a/include/qemu/qtree.h b/include/qemu/qtree.h
index 69fe74b50d0..dc2b14d2582 100644
--- a/include/qemu/qtree.h
+++ b/include/qemu/qtree.h
@@ -42,7 +42,6 @@
 #ifndef QEMU_QTREE_H
 #define QEMU_QTREE_H
 
-#include "qemu/osdep.h"
 
 #ifdef HAVE_GLIB_WITH_SLICE_ALLOCATOR
 
diff --git a/include/ui/rect.h b/include/ui/rect.h
index 68f05d78a8e..7ebf47ebcdc 100644
--- a/include/ui/rect.h
+++ b/include/ui/rect.h
@@ -4,8 +4,6 @@
 #ifndef QEMU_RECT_H
 #define QEMU_RECT_H
 
-#include <stdint.h>
-#include <stdbool.h>
 
 typedef struct QemuRect {
     int16_t x;
-- 
2.34.1
Re: [PATCH 07/10] include: Clean up includes
Posted by Zhao Liu 10 months ago
On Thu, Jan 25, 2024 at 04:34:05PM +0000, Peter Maydell wrote:
> Date: Thu, 25 Jan 2024 16:34:05 +0000
> From: Peter Maydell <peter.maydell@linaro.org>
> Subject: [PATCH 07/10] include: Clean up includes
> X-Mailer: git-send-email 2.34.1
> 
> This commit was created with scripts/clean-includes:
>  ./scripts/clean-includes --git include include/*/*.h include/*/*/*.h
> 
> All .c should include qemu/osdep.h first.  The script performs three
> related cleanups:
> 
> * Ensure .c files include qemu/osdep.h first.
> * Including it in a .h is redundant, since the .c  already includes
>   it.  Drop such inclusions.
> * Likewise, including headers qemu/osdep.h includes is redundant.
>   Drop these, too.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I hand-checked that all these headers are included only by .c
> files which already have osdep.h included.
> ---
>  include/hw/arm/raspberrypi-fw-defs.h | 1 -
>  include/hw/mem/memory-device.h       | 1 -
>  include/hw/ppc/spapr_nested.h        | 1 -
>  include/hw/xen/xen-hvm-common.h      | 1 -
>  include/qemu/qtree.h                 | 1 -
>  include/ui/rect.h                    | 2 --
>  6 files changed, 7 deletions(-)

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>

> 
> diff --git a/include/hw/arm/raspberrypi-fw-defs.h b/include/hw/arm/raspberrypi-fw-defs.h
> index 4551fe7450d..579cf0d5546 100644
> --- a/include/hw/arm/raspberrypi-fw-defs.h
> +++ b/include/hw/arm/raspberrypi-fw-defs.h
> @@ -10,7 +10,6 @@
>  #ifndef INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_
>  #define INCLUDE_HW_MISC_RASPBERRYPI_FW_DEFS_H_
>  
> -#include "qemu/osdep.h"
>  
>  enum rpi_firmware_property_tag {
>      RPI_FWREQ_PROPERTY_END =                           0,
> diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
> index a1d62cc551a..e0571c8a319 100644
> --- a/include/hw/mem/memory-device.h
> +++ b/include/hw/mem/memory-device.h
> @@ -14,7 +14,6 @@
>  #define MEMORY_DEVICE_H
>  
>  #include "hw/qdev-core.h"
> -#include "qemu/typedefs.h"
>  #include "qapi/qapi-types-machine.h"
>  #include "qom/object.h"
>  
> diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h
> index d3834864764..d312a5d61da 100644
> --- a/include/hw/ppc/spapr_nested.h
> +++ b/include/hw/ppc/spapr_nested.h
> @@ -1,7 +1,6 @@
>  #ifndef HW_SPAPR_NESTED_H
>  #define HW_SPAPR_NESTED_H
>  
> -#include "qemu/osdep.h"
>  #include "target/ppc/cpu.h"
>  
>  /*
> diff --git a/include/hw/xen/xen-hvm-common.h b/include/hw/xen/xen-hvm-common.h
> index 4e9904f1a65..4b1d728f35c 100644
> --- a/include/hw/xen/xen-hvm-common.h
> +++ b/include/hw/xen/xen-hvm-common.h
> @@ -1,7 +1,6 @@
>  #ifndef HW_XEN_HVM_COMMON_H
>  #define HW_XEN_HVM_COMMON_H
>  
> -#include "qemu/osdep.h"
>  #include "qemu/units.h"
>  
>  #include "cpu.h"
> diff --git a/include/qemu/qtree.h b/include/qemu/qtree.h
> index 69fe74b50d0..dc2b14d2582 100644
> --- a/include/qemu/qtree.h
> +++ b/include/qemu/qtree.h
> @@ -42,7 +42,6 @@
>  #ifndef QEMU_QTREE_H
>  #define QEMU_QTREE_H
>  
> -#include "qemu/osdep.h"
>  
>  #ifdef HAVE_GLIB_WITH_SLICE_ALLOCATOR
>  
> diff --git a/include/ui/rect.h b/include/ui/rect.h
> index 68f05d78a8e..7ebf47ebcdc 100644
> --- a/include/ui/rect.h
> +++ b/include/ui/rect.h
> @@ -4,8 +4,6 @@
>  #ifndef QEMU_RECT_H
>  #define QEMU_RECT_H
>  
> -#include <stdint.h>
> -#include <stdbool.h>
>  
>  typedef struct QemuRect {
>      int16_t x;
> -- 
> 2.34.1
> 
>