[PATCH-for-8.0 1/2] typedefs: Forward-declare AccelState

Philippe Mathieu-Daudé posted 2 patches 3 years, 2 months ago
Maintainers: Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH-for-8.0 1/2] typedefs: Forward-declare AccelState
Posted by Philippe Mathieu-Daudé 3 years, 2 months ago
Forward-declare AccelState in "qemu/typedefs.h" so structures
using a reference of it (like MachineState in "hw/boards.h")
don't have to include "qemu/accel.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/qemu/accel.h    | 4 ++--
 include/qemu/typedefs.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/qemu/accel.h b/include/qemu/accel.h
index ce4747634a..e84db2e3e5 100644
--- a/include/qemu/accel.h
+++ b/include/qemu/accel.h
@@ -26,10 +26,10 @@
 #include "qom/object.h"
 #include "exec/hwaddr.h"
 
-typedef struct AccelState {
+struct AccelState {
     /*< private >*/
     Object parent_obj;
-} AccelState;
+};
 
 typedef struct AccelClass {
     /*< private >*/
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 688408e048..073abab998 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -21,6 +21,7 @@
  * Incomplete struct types
  * Please keep this list in case-insensitive alphabetical order.
  */
+typedef struct AccelState AccelState;
 typedef struct AdapterInfo AdapterInfo;
 typedef struct AddressSpace AddressSpace;
 typedef struct AioContext AioContext;
-- 
2.38.1


Re: [PATCH-for-8.0 1/2] typedefs: Forward-declare AccelState
Posted by Richard Henderson 3 years, 2 months ago
On 11/30/22 05:56, Philippe Mathieu-Daudé wrote:
> Forward-declare AccelState in "qemu/typedefs.h" so structures
> using a reference of it (like MachineState in "hw/boards.h")
> don't have to include "qemu/accel.h".
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   include/qemu/accel.h    | 4 ++--
>   include/qemu/typedefs.h | 1 +
>   2 files changed, 3 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH-for-8.0 1/2] typedefs: Forward-declare AccelState
Posted by Fabiano Rosas 3 years, 2 months ago
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> Forward-declare AccelState in "qemu/typedefs.h" so structures
> using a reference of it (like MachineState in "hw/boards.h")
> don't have to include "qemu/accel.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Fabiano Rosas <farosas@suse.de>