All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
@ 2019-01-21 18:10 Philippe Mathieu-Daudé
  2019-01-21 19:22 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-21 18:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Yuri Benditovich, Thomas Huth, Wei Xu,
	Philippe Mathieu-Daudé,
	Peter Maydell

Commit 2974e916df8 introduced the VirtioNetRscChain structure which
refer to a VirtIONet, declared later, thus required VirtIONet typedef
to be declarated forward.
However, when compiling with Clang in -std=gnu99 mode, this triggers
the following warning/error:

    CC      hw/net/virtio-net.o
  In file included from qemu/hw/net/virtio-net.c:22:
  include/hw/virtio/virtio-net.h:189:3: error: redefinition of typedef 'VirtIONet' is a C11 feature [-Werror,-Wtypedef-redefinition]
  } VirtIONet;
    ^
  include/hw/virtio/virtio-net.h:110:26: note: previous definition is here
  typedef struct VirtIONet VirtIONet;
                           ^
  1 error generated.
  make: *** [rules.mak:69: hw/net/virtio-net.o] Error 1

Fix it by removing the duplicate typedef definition.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/hw/virtio/virtio-net.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
index c7ec1a755f..bd662752d2 100644
--- a/include/hw/virtio/virtio-net.h
+++ b/include/hw/virtio/virtio-net.h
@@ -106,7 +106,6 @@ typedef struct VirtioNetRscSeg {
     NetClientState *nc;
 } VirtioNetRscSeg;
 
-struct VirtIONet;
 typedef struct VirtIONet VirtIONet;
 
 /* Chain is divided by protocol(ipv4/v6) and NetClientInfo */
@@ -136,7 +135,7 @@ typedef struct VirtIONetQueue {
     struct VirtIONet *n;
 } VirtIONetQueue;
 
-typedef struct VirtIONet {
+struct VirtIONet {
     VirtIODevice parent_obj;
     uint8_t mac[ETH_ALEN];
     uint16_t status;
@@ -186,7 +185,7 @@ typedef struct VirtIONet {
     int announce_counter;
     bool needs_vnet_hdr_swap;
     bool mtu_bypass_backend;
-} VirtIONet;
+};
 
 void virtio_net_set_netclient_name(VirtIONet *n, const char *name,
                                    const char *type);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
  2019-01-21 18:10 [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition Philippe Mathieu-Daudé
@ 2019-01-21 19:22 ` Eric Blake
  2019-01-21 19:46   ` Philippe Mathieu-Daudé
  2019-01-21 21:53 ` Greg Kurz
  2019-01-22  5:04 ` Michael S. Tsirkin
  2 siblings, 1 reply; 9+ messages in thread
From: Eric Blake @ 2019-01-21 19:22 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Thomas Huth, Michael S. Tsirkin, Yuri Benditovich, Wei Xu

[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]

On 1/21/19 12:10 PM, Philippe Mathieu-Daudé wrote:
> Commit 2974e916df8 introduced the VirtioNetRscChain structure which
> refer to a VirtIONet, declared later, thus required VirtIONet typedef
> to be declarated forward.

s/be declarated forward/use a forward declaration/

> However, when compiling with Clang in -std=gnu99 mode, this triggers
> the following warning/error:
> 
>     CC      hw/net/virtio-net.o
>   In file included from qemu/hw/net/virtio-net.c:22:
>   include/hw/virtio/virtio-net.h:189:3: error: redefinition of typedef 'VirtIONet' is a C11 feature [-Werror,-Wtypedef-redefinition]
>   } VirtIONet;
>     ^
>   include/hw/virtio/virtio-net.h:110:26: note: previous definition is here
>   typedef struct VirtIONet VirtIONet;
>                            ^
>   1 error generated.
>   make: *** [rules.mak:69: hw/net/virtio-net.o] Error 1
> 
> Fix it by removing the duplicate typedef definition.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/hw/virtio/virtio-net.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
  2019-01-21 19:22 ` Eric Blake
@ 2019-01-21 19:46   ` Philippe Mathieu-Daudé
  2019-01-22  4:28     ` Thomas Huth
  0 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-01-21 19:46 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: Peter Maydell, Thomas Huth, Michael S. Tsirkin, Yuri Benditovich, Wei Xu

[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]

On 1/21/19 8:22 PM, Eric Blake wrote:
> On 1/21/19 12:10 PM, Philippe Mathieu-Daudé wrote:
>> Commit 2974e916df8 introduced the VirtioNetRscChain structure which
>> refer to a VirtIONet, declared later, thus required VirtIONet typedef
>> to be declarated forward.
> 
> s/be declarated forward/use a forward declaration/

Thanks Eric.

Thomas, do you mind fixing this if you take this patch?

>> However, when compiling with Clang in -std=gnu99 mode, this triggers
>> the following warning/error:
>>
>>     CC      hw/net/virtio-net.o
>>   In file included from qemu/hw/net/virtio-net.c:22:
>>   include/hw/virtio/virtio-net.h:189:3: error: redefinition of typedef 'VirtIONet' is a C11 feature [-Werror,-Wtypedef-redefinition]
>>   } VirtIONet;
>>     ^
>>   include/hw/virtio/virtio-net.h:110:26: note: previous definition is here
>>   typedef struct VirtIONet VirtIONet;
>>                            ^
>>   1 error generated.
>>   make: *** [rules.mak:69: hw/net/virtio-net.o] Error 1
>>
>> Fix it by removing the duplicate typedef definition.
>>
>> Reported-by: Peter Maydell <peter.maydell@linaro.org>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  include/hw/virtio/virtio-net.h | 5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
  2019-01-21 18:10 [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition Philippe Mathieu-Daudé
  2019-01-21 19:22 ` Eric Blake
@ 2019-01-21 21:53 ` Greg Kurz
  2019-01-22  5:04 ` Michael S. Tsirkin
  2 siblings, 0 replies; 9+ messages in thread
From: Greg Kurz @ 2019-01-21 21:53 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Peter Maydell, Thomas Huth, Michael S. Tsirkin,
	Yuri Benditovich, Wei Xu

On Mon, 21 Jan 2019 19:10:30 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:

> Commit 2974e916df8 introduced the VirtioNetRscChain structure which
> refer to a VirtIONet, declared later, thus required VirtIONet typedef
> to be declarated forward.
> However, when compiling with Clang in -std=gnu99 mode, this triggers
> the following warning/error:
> 
>     CC      hw/net/virtio-net.o
>   In file included from qemu/hw/net/virtio-net.c:22:
>   include/hw/virtio/virtio-net.h:189:3: error: redefinition of typedef 'VirtIONet' is a C11 feature [-Werror,-Wtypedef-redefinition]
>   } VirtIONet;
>     ^
>   include/hw/virtio/virtio-net.h:110:26: note: previous definition is here
>   typedef struct VirtIONet VirtIONet;
>                            ^
>   1 error generated.
>   make: *** [rules.mak:69: hw/net/virtio-net.o] Error 1
> 
> Fix it by removing the duplicate typedef definition.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  include/hw/virtio/virtio-net.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
> index c7ec1a755f..bd662752d2 100644
> --- a/include/hw/virtio/virtio-net.h
> +++ b/include/hw/virtio/virtio-net.h
> @@ -106,7 +106,6 @@ typedef struct VirtioNetRscSeg {
>      NetClientState *nc;
>  } VirtioNetRscSeg;
>  
> -struct VirtIONet;
>  typedef struct VirtIONet VirtIONet;
>  
>  /* Chain is divided by protocol(ipv4/v6) and NetClientInfo */
> @@ -136,7 +135,7 @@ typedef struct VirtIONetQueue {
>      struct VirtIONet *n;
>  } VirtIONetQueue;
>  
> -typedef struct VirtIONet {
> +struct VirtIONet {
>      VirtIODevice parent_obj;
>      uint8_t mac[ETH_ALEN];
>      uint16_t status;
> @@ -186,7 +185,7 @@ typedef struct VirtIONet {
>      int announce_counter;
>      bool needs_vnet_hdr_swap;
>      bool mtu_bypass_backend;
> -} VirtIONet;
> +};
>  
>  void virtio_net_set_netclient_name(VirtIONet *n, const char *name,
>                                     const char *type);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
  2019-01-21 19:46   ` Philippe Mathieu-Daudé
@ 2019-01-22  4:28     ` Thomas Huth
  2019-01-22  5:05       ` Michael S. Tsirkin
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Huth @ 2019-01-22  4:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Eric Blake, qemu-devel
  Cc: Peter Maydell, Michael S. Tsirkin, Yuri Benditovich, Wei Xu

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

On 2019-01-21 20:46, Philippe Mathieu-Daudé wrote:
> On 1/21/19 8:22 PM, Eric Blake wrote:
>> On 1/21/19 12:10 PM, Philippe Mathieu-Daudé wrote:
>>> Commit 2974e916df8 introduced the VirtioNetRscChain structure which
>>> refer to a VirtIONet, declared later, thus required VirtIONet typedef
>>> to be declarated forward.
>>
>> s/be declarated forward/use a forward declaration/
> 
> Thanks Eric.
> 
> Thomas, do you mind fixing this if you take this patch?

No problem, just fixed it while picking up the patch.

 Thanks,
  Thomas


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
  2019-01-21 18:10 [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition Philippe Mathieu-Daudé
  2019-01-21 19:22 ` Eric Blake
  2019-01-21 21:53 ` Greg Kurz
@ 2019-01-22  5:04 ` Michael S. Tsirkin
  2 siblings, 0 replies; 9+ messages in thread
From: Michael S. Tsirkin @ 2019-01-22  5:04 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Yuri Benditovich, Thomas Huth, Wei Xu, Peter Maydell

On Mon, Jan 21, 2019 at 07:10:30PM +0100, Philippe Mathieu-Daudé wrote:
> Commit 2974e916df8 introduced the VirtioNetRscChain structure which
> refer to a VirtIONet, declared later, thus required VirtIONet typedef
> to be declarated forward.
> However, when compiling with Clang in -std=gnu99 mode, this triggers
> the following warning/error:
> 
>     CC      hw/net/virtio-net.o
>   In file included from qemu/hw/net/virtio-net.c:22:
>   include/hw/virtio/virtio-net.h:189:3: error: redefinition of typedef 'VirtIONet' is a C11 feature [-Werror,-Wtypedef-redefinition]
>   } VirtIONet;
>     ^
>   include/hw/virtio/virtio-net.h:110:26: note: previous definition is here
>   typedef struct VirtIONet VirtIONet;
>                            ^
>   1 error generated.
>   make: *** [rules.mak:69: hw/net/virtio-net.o] Error 1
> 
> Fix it by removing the duplicate typedef definition.
> 
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  include/hw/virtio/virtio-net.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
> index c7ec1a755f..bd662752d2 100644
> --- a/include/hw/virtio/virtio-net.h
> +++ b/include/hw/virtio/virtio-net.h
> @@ -106,7 +106,6 @@ typedef struct VirtioNetRscSeg {
>      NetClientState *nc;
>  } VirtioNetRscSeg;
>  
> -struct VirtIONet;
>  typedef struct VirtIONet VirtIONet;
>  
>  /* Chain is divided by protocol(ipv4/v6) and NetClientInfo */
> @@ -136,7 +135,7 @@ typedef struct VirtIONetQueue {
>      struct VirtIONet *n;
>  } VirtIONetQueue;
>  
> -typedef struct VirtIONet {
> +struct VirtIONet {
>      VirtIODevice parent_obj;
>      uint8_t mac[ETH_ALEN];
>      uint16_t status;
> @@ -186,7 +185,7 @@ typedef struct VirtIONet {
>      int announce_counter;
>      bool needs_vnet_hdr_swap;
>      bool mtu_bypass_backend;
> -} VirtIONet;
> +};
>  
>  void virtio_net_set_netclient_name(VirtIONet *n, const char *name,
>                                     const char *type);
> -- 
> 2.20.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
  2019-01-22  4:28     ` Thomas Huth
@ 2019-01-22  5:05       ` Michael S. Tsirkin
  2019-01-22  5:23         ` Thomas Huth
  0 siblings, 1 reply; 9+ messages in thread
From: Michael S. Tsirkin @ 2019-01-22  5:05 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Philippe Mathieu-Daudé,
	Eric Blake, qemu-devel, Peter Maydell, Yuri Benditovich, Wei Xu

On Tue, Jan 22, 2019 at 05:28:12AM +0100, Thomas Huth wrote:
> On 2019-01-21 20:46, Philippe Mathieu-Daudé wrote:
> > On 1/21/19 8:22 PM, Eric Blake wrote:
> >> On 1/21/19 12:10 PM, Philippe Mathieu-Daudé wrote:
> >>> Commit 2974e916df8 introduced the VirtioNetRscChain structure which
> >>> refer to a VirtIONet, declared later, thus required VirtIONet typedef
> >>> to be declarated forward.
> >>
> >> s/be declarated forward/use a forward declaration/
> > 
> > Thanks Eric.
> > 
> > Thomas, do you mind fixing this if you take this patch?
> 
> No problem, just fixed it while picking up the patch.
> 
>  Thanks,
>   Thomas
> 


I'm not sure why it's going through that tree but sure go ahead.
Sent Reviewed-by tag.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
  2019-01-22  5:05       ` Michael S. Tsirkin
@ 2019-01-22  5:23         ` Thomas Huth
  2019-01-22 13:55           ` Michael S. Tsirkin
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Huth @ 2019-01-22  5:23 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Philippe Mathieu-Daudé,
	Eric Blake, qemu-devel, Peter Maydell, Yuri Benditovich, Wei Xu

On 2019-01-22 06:05, Michael S. Tsirkin wrote:
> On Tue, Jan 22, 2019 at 05:28:12AM +0100, Thomas Huth wrote:
>> On 2019-01-21 20:46, Philippe Mathieu-Daudé wrote:
>>> On 1/21/19 8:22 PM, Eric Blake wrote:
>>>> On 1/21/19 12:10 PM, Philippe Mathieu-Daudé wrote:
>>>>> Commit 2974e916df8 introduced the VirtioNetRscChain structure which
>>>>> refer to a VirtIONet, declared later, thus required VirtIONet typedef
>>>>> to be declarated forward.
>>>>
>>>> s/be declarated forward/use a forward declaration/
>>>
>>> Thanks Eric.
>>>
>>> Thomas, do you mind fixing this if you take this patch?
>>
>> No problem, just fixed it while picking up the patch.
> 
> I'm not sure why it's going through that tree but sure go ahead.

Sorry, I certainly don't want to step on your toes here. I just need
this patch to fix compilation with "-std=gnu99" which is required for
the patch in my PULL request that enables this compiler flag there:

https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg02695.html

> Sent Reviewed-by tag.

Thanks a lot!

 Thomas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition
  2019-01-22  5:23         ` Thomas Huth
@ 2019-01-22 13:55           ` Michael S. Tsirkin
  0 siblings, 0 replies; 9+ messages in thread
From: Michael S. Tsirkin @ 2019-01-22 13:55 UTC (permalink / raw)
  To: Thomas Huth
  Cc: Philippe Mathieu-Daudé,
	Eric Blake, qemu-devel, Peter Maydell, Yuri Benditovich, Wei Xu

On Tue, Jan 22, 2019 at 06:23:34AM +0100, Thomas Huth wrote:
> On 2019-01-22 06:05, Michael S. Tsirkin wrote:
> > On Tue, Jan 22, 2019 at 05:28:12AM +0100, Thomas Huth wrote:
> >> On 2019-01-21 20:46, Philippe Mathieu-Daudé wrote:
> >>> On 1/21/19 8:22 PM, Eric Blake wrote:
> >>>> On 1/21/19 12:10 PM, Philippe Mathieu-Daudé wrote:
> >>>>> Commit 2974e916df8 introduced the VirtioNetRscChain structure which
> >>>>> refer to a VirtIONet, declared later, thus required VirtIONet typedef
> >>>>> to be declarated forward.
> >>>>
> >>>> s/be declarated forward/use a forward declaration/
> >>>
> >>> Thanks Eric.
> >>>
> >>> Thomas, do you mind fixing this if you take this patch?
> >>
> >> No problem, just fixed it while picking up the patch.
> > 
> > I'm not sure why it's going through that tree but sure go ahead.
> 
> Sorry, I certainly don't want to step on your toes here. I just need
> this patch to fix compilation with "-std=gnu99" which is required for
> the patch in my PULL request that enables this compiler flag there:
> 
> https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg02695.html

Oh. Your tree makes sense then.

> > Sent Reviewed-by tag.
> 
> Thanks a lot!
> 
>  Thomas

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-01-22 18:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 18:10 [Qemu-devel] [PATCH] virtio-net: Fix VirtIONet typedef redefinition Philippe Mathieu-Daudé
2019-01-21 19:22 ` Eric Blake
2019-01-21 19:46   ` Philippe Mathieu-Daudé
2019-01-22  4:28     ` Thomas Huth
2019-01-22  5:05       ` Michael S. Tsirkin
2019-01-22  5:23         ` Thomas Huth
2019-01-22 13:55           ` Michael S. Tsirkin
2019-01-21 21:53 ` Greg Kurz
2019-01-22  5:04 ` Michael S. Tsirkin

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.