* [Qemu-devel] [PATCH v6] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode
@ 2019-01-17 8:59 Thomas Huth
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2019-01-17 8:59 UTC (permalink / raw)
To: qemu-devel, Cédric Le Goater, Greg Kurz; +Cc: qemu-ppc, david
When compiling the ppc code with clang and -std=gnu99, there are a
couple of warnings/errors like this one:
CC ppc64-softmmu/hw/intc/xics.o
In file included from hw/intc/xics.c:35:
include/hw/ppc/xics.h:43:25: error: redefinition of typedef 'ICPState' is a C11 feature
[-Werror,-Wtypedef-redefinition]
typedef struct ICPState ICPState;
^
target/ppc/cpu.h:1181:25: note: previous definition is here
typedef struct ICPState ICPState;
^
Work around the problems by including the proper headers in spapr.h
and by using struct forward declarations in cpu.h.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
As discussed on IRC, Cédric's patches likely should go via David's ppc-
tree, so I'll go with this version here for my gnu99-PULL request.
(v6: Don't use #includes in cpu.h, use forward struct definitions instead)
include/hw/ppc/spapr.h | 5 +++--
include/hw/ppc/spapr_xive.h | 2 --
target/ppc/cpu.h | 9 +++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 9e01a5a..a947a0a 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -8,15 +8,16 @@
#include "hw/mem/pc-dimm.h"
#include "hw/ppc/spapr_ovec.h"
#include "hw/ppc/spapr_irq.h"
+#include "hw/ppc/spapr_xive.h" /* For sPAPRXive */
+#include "hw/ppc/xics.h" /* For ICSState */
struct VIOsPAPRBus;
struct sPAPRPHBState;
struct sPAPRNVRAM;
+
typedef struct sPAPREventLogEntry sPAPREventLogEntry;
typedef struct sPAPREventSource sPAPREventSource;
typedef struct sPAPRPendingHPT sPAPRPendingHPT;
-typedef struct ICSState ICSState;
-typedef struct sPAPRXive sPAPRXive;
#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL
#define SPAPR_ENTRY_POINT 0x100
diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h
index 7fdc250..9bec919 100644
--- a/include/hw/ppc/spapr_xive.h
+++ b/include/hw/ppc/spapr_xive.h
@@ -41,8 +41,6 @@ bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn, bool lsi);
bool spapr_xive_irq_free(sPAPRXive *xive, uint32_t lisn);
void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon);
-typedef struct sPAPRMachineState sPAPRMachineState;
-
void spapr_xive_hcall_init(sPAPRMachineState *spapr);
void spapr_dt_xive(sPAPRMachineState *spapr, uint32_t nr_servers, void *fdt,
uint32_t phandle);
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 486abaf..a62ff60 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1177,8 +1177,9 @@ do { \
typedef struct PPCVirtualHypervisor PPCVirtualHypervisor;
typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass;
-typedef struct XiveTCTX XiveTCTX;
-typedef struct ICPState ICPState;
+
+struct XiveTCTX;
+struct ICPState;
/**
* PowerPCCPU:
@@ -1197,8 +1198,8 @@ struct PowerPCCPU {
int vcpu_id;
uint32_t compat_pvr;
PPCVirtualHypervisor *vhyp;
- ICPState *icp;
- XiveTCTX *tctx;
+ struct ICPState *icp;
+ struct XiveTCTX *tctx;
void *machine_data;
int32_t node_id; /* NUMA node this CPU belongs to */
PPCHash64Options *hash64_opts;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH v6] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode
2019-01-17 9:00 ` [Qemu-devel] [PATCH v6] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode Thomas Huth
@ 2019-01-17 9:20 ` Greg Kurz
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kurz @ 2019-01-17 9:20 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-devel, Cédric Le Goater, qemu-ppc, david
On Thu, 17 Jan 2019 10:00:49 +0100
Thomas Huth <thuth@redhat.com> wrote:
> When compiling the ppc code with clang and -std=gnu99, there are a
> couple of warnings/errors like this one:
>
> CC ppc64-softmmu/hw/intc/xics.o
> In file included from hw/intc/xics.c:35:
> include/hw/ppc/xics.h:43:25: error: redefinition of typedef 'ICPState' is a C11 feature
> [-Werror,-Wtypedef-redefinition]
> typedef struct ICPState ICPState;
> ^
> target/ppc/cpu.h:1181:25: note: previous definition is here
> typedef struct ICPState ICPState;
> ^
> Work around the problems by including the proper headers in spapr.h
> and by using struct forward declarations in cpu.h.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> As discussed on IRC, Cédric's patches likely should go via David's ppc-
> tree, so I'll go with this version here for my gnu99-PULL request.
> (v6: Don't use #includes in cpu.h, use forward struct definitions instead)
>
Yeah, now that we know where we're going, I would certainly not hold your
gnu99 work off anymore :)
Reviewed-by: Greg Kurz <groug@kaod.org>
> include/hw/ppc/spapr.h | 5 +++--
> include/hw/ppc/spapr_xive.h | 2 --
> target/ppc/cpu.h | 9 +++++----
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 9e01a5a..a947a0a 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -8,15 +8,16 @@
> #include "hw/mem/pc-dimm.h"
> #include "hw/ppc/spapr_ovec.h"
> #include "hw/ppc/spapr_irq.h"
> +#include "hw/ppc/spapr_xive.h" /* For sPAPRXive */
> +#include "hw/ppc/xics.h" /* For ICSState */
>
> struct VIOsPAPRBus;
> struct sPAPRPHBState;
> struct sPAPRNVRAM;
> +
> typedef struct sPAPREventLogEntry sPAPREventLogEntry;
> typedef struct sPAPREventSource sPAPREventSource;
> typedef struct sPAPRPendingHPT sPAPRPendingHPT;
> -typedef struct ICSState ICSState;
> -typedef struct sPAPRXive sPAPRXive;
>
> #define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL
> #define SPAPR_ENTRY_POINT 0x100
> diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h
> index 7fdc250..9bec919 100644
> --- a/include/hw/ppc/spapr_xive.h
> +++ b/include/hw/ppc/spapr_xive.h
> @@ -41,8 +41,6 @@ bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn, bool lsi);
> bool spapr_xive_irq_free(sPAPRXive *xive, uint32_t lisn);
> void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon);
>
> -typedef struct sPAPRMachineState sPAPRMachineState;
> -
> void spapr_xive_hcall_init(sPAPRMachineState *spapr);
> void spapr_dt_xive(sPAPRMachineState *spapr, uint32_t nr_servers, void *fdt,
> uint32_t phandle);
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 486abaf..a62ff60 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -1177,8 +1177,9 @@ do { \
>
> typedef struct PPCVirtualHypervisor PPCVirtualHypervisor;
> typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass;
> -typedef struct XiveTCTX XiveTCTX;
> -typedef struct ICPState ICPState;
> +
> +struct XiveTCTX;
> +struct ICPState;
>
> /**
> * PowerPCCPU:
> @@ -1197,8 +1198,8 @@ struct PowerPCCPU {
> int vcpu_id;
> uint32_t compat_pvr;
> PPCVirtualHypervisor *vhyp;
> - ICPState *icp;
> - XiveTCTX *tctx;
> + struct ICPState *icp;
> + struct XiveTCTX *tctx;
> void *machine_data;
> int32_t node_id; /* NUMA node this CPU belongs to */
> PPCHash64Options *hash64_opts;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH v6] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode
2019-01-17 8:26 [Qemu-devel] [PATCH 4/4] ppc: remove the interrupt presenters from under PowerPCCPU Cédric Le Goater
@ 2019-01-17 9:00 ` Thomas Huth
2019-01-17 9:20 ` Greg Kurz
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2019-01-17 9:00 UTC (permalink / raw)
To: qemu-devel, Cédric Le Goater, Greg Kurz; +Cc: qemu-ppc, david
When compiling the ppc code with clang and -std=gnu99, there are a
couple of warnings/errors like this one:
CC ppc64-softmmu/hw/intc/xics.o
In file included from hw/intc/xics.c:35:
include/hw/ppc/xics.h:43:25: error: redefinition of typedef 'ICPState' is a C11 feature
[-Werror,-Wtypedef-redefinition]
typedef struct ICPState ICPState;
^
target/ppc/cpu.h:1181:25: note: previous definition is here
typedef struct ICPState ICPState;
^
Work around the problems by including the proper headers in spapr.h
and by using struct forward declarations in cpu.h.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
As discussed on IRC, Cédric's patches likely should go via David's ppc-
tree, so I'll go with this version here for my gnu99-PULL request.
(v6: Don't use #includes in cpu.h, use forward struct definitions instead)
include/hw/ppc/spapr.h | 5 +++--
include/hw/ppc/spapr_xive.h | 2 --
target/ppc/cpu.h | 9 +++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 9e01a5a..a947a0a 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -8,15 +8,16 @@
#include "hw/mem/pc-dimm.h"
#include "hw/ppc/spapr_ovec.h"
#include "hw/ppc/spapr_irq.h"
+#include "hw/ppc/spapr_xive.h" /* For sPAPRXive */
+#include "hw/ppc/xics.h" /* For ICSState */
struct VIOsPAPRBus;
struct sPAPRPHBState;
struct sPAPRNVRAM;
+
typedef struct sPAPREventLogEntry sPAPREventLogEntry;
typedef struct sPAPREventSource sPAPREventSource;
typedef struct sPAPRPendingHPT sPAPRPendingHPT;
-typedef struct ICSState ICSState;
-typedef struct sPAPRXive sPAPRXive;
#define HPTE64_V_HPTE_DIRTY 0x0000000000000040ULL
#define SPAPR_ENTRY_POINT 0x100
diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h
index 7fdc250..9bec919 100644
--- a/include/hw/ppc/spapr_xive.h
+++ b/include/hw/ppc/spapr_xive.h
@@ -41,8 +41,6 @@ bool spapr_xive_irq_claim(sPAPRXive *xive, uint32_t lisn, bool lsi);
bool spapr_xive_irq_free(sPAPRXive *xive, uint32_t lisn);
void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon);
-typedef struct sPAPRMachineState sPAPRMachineState;
-
void spapr_xive_hcall_init(sPAPRMachineState *spapr);
void spapr_dt_xive(sPAPRMachineState *spapr, uint32_t nr_servers, void *fdt,
uint32_t phandle);
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 486abaf..a62ff60 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1177,8 +1177,9 @@ do { \
typedef struct PPCVirtualHypervisor PPCVirtualHypervisor;
typedef struct PPCVirtualHypervisorClass PPCVirtualHypervisorClass;
-typedef struct XiveTCTX XiveTCTX;
-typedef struct ICPState ICPState;
+
+struct XiveTCTX;
+struct ICPState;
/**
* PowerPCCPU:
@@ -1197,8 +1198,8 @@ struct PowerPCCPU {
int vcpu_id;
uint32_t compat_pvr;
PPCVirtualHypervisor *vhyp;
- ICPState *icp;
- XiveTCTX *tctx;
+ struct ICPState *icp;
+ struct XiveTCTX *tctx;
void *machine_data;
int32_t node_id; /* NUMA node this CPU belongs to */
PPCHash64Options *hash64_opts;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-17 9:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 8:59 [Qemu-devel] [PATCH v6] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode Thomas Huth
-- strict thread matches above, loose matches on Subject: below --
2019-01-17 8:26 [Qemu-devel] [PATCH 4/4] ppc: remove the interrupt presenters from under PowerPCCPU Cédric Le Goater
2019-01-17 9:00 ` [Qemu-devel] [PATCH v6] ppc: Fix duplicated typedefs to be able to compile with Clang in gnu99 mode Thomas Huth
2019-01-17 9:20 ` Greg Kurz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.