Message ID | 1365136091-26148-2-git-send-email-lig.fnst@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
On 5 April 2013 05:28, liguang <lig.fnst@cn.fujitsu.com> wrote: > define struct IRQState in irq.c bring in > a annoying result, if you want dereference of > IRQState's member like opaque outside of > irq.c, compiler will complain: > "error: dereferencing pointer to incomplete type" No, this is deliberate -- it's an opaque type which should only be used inside irq.c. If you think you need to dereference it you're probably doing something wrong. thanks -- PMM
在 2013-04-05五的 09:34 +0100,Peter Maydell写道: > On 5 April 2013 05:28, liguang <lig.fnst@cn.fujitsu.com> wrote: > > define struct IRQState in irq.c bring in > > a annoying result, if you want dereference of > > IRQState's member like opaque outside of > > irq.c, compiler will complain: > > "error: dereferencing pointer to incomplete type" > > No, this is deliberate -- it's an opaque type which should > only be used inside irq.c. If you think you need to dereference > it you're probably doing something wrong. > Yes, you're right, it's only a suggestion for some hacking conditions.
diff --git a/hw/irq.c b/hw/irq.c index 2078542..100890f 100644 --- a/hw/irq.c +++ b/hw/irq.c @@ -24,12 +24,6 @@ #include "qemu-common.h" #include "hw/irq.h" -struct IRQState { - qemu_irq_handler handler; - void *opaque; - int n; -}; - void qemu_set_irq(qemu_irq irq, int level) { if (!irq) diff --git a/hw/irq.h b/hw/irq.h index 610e6b7..7ae152d 100644 --- a/hw/irq.h +++ b/hw/irq.h @@ -7,6 +7,12 @@ typedef struct IRQState *qemu_irq; typedef void (*qemu_irq_handler)(void *opaque, int n, int level); +struct IRQState { + qemu_irq_handler handler; + void *opaque; + int n; +}; + void qemu_set_irq(qemu_irq irq, int level); static inline void qemu_irq_raise(qemu_irq irq)
define struct IRQState in irq.c bring in a annoying result, if you want dereference of IRQState's member like opaque outside of irq.c, compiler will complain: "error: dereferencing pointer to incomplete type" Signed-off-by: liguang <lig.fnst@cn.fujitsu.com> --- hw/irq.c | 6 ------ hw/irq.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-)