[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180905125636-mutt-send-email-mst@kernel.org>
Date: Wed, 5 Sep 2018 13:35:29 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: David Howells <dhowells@...hat.com>
Cc: linux-api@...r.kernel.org, linux-kbuild@...r.kernel.org,
Jason Wang <jasowang@...hat.com>,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/11] UAPI: virtio_net: Fix use of C++ keywords as
structural members
On Wed, Sep 05, 2018 at 04:54:55PM +0100, David Howells wrote:
> The virtio_net_ctrl_hdr struct uses a C++ keyword as structural members. Fix
> this by inserting an anonymous union that provides an alternative name and
> then hide the reserved name in C++.
>
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: "Michael S. Tsirkin" <mst@...hat.com>
> cc: Jason Wang <jasowang@...hat.com>
> cc: virtualization@...ts.linux-foundation.org
> ---
>
> include/uapi/linux/virtio_net.h | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
> index a3715a3224c1..967142bc0e05 100644
> --- a/include/uapi/linux/virtio_net.h
> +++ b/include/uapi/linux/virtio_net.h
> @@ -150,7 +150,12 @@ struct virtio_net_hdr_mrg_rxbuf {
> * command goes in between.
> */
> struct virtio_net_ctrl_hdr {
> - __u8 class;
> + union {
> +#ifndef __cplusplus
> + __u8 class;
> +#endif
> + __u8 _class;
> + };
> __u8 cmd;
> } __attribute__((packed));
As long as you do not intend to use any classes, how about
simply adding
-Dclass=_class
to your command line?
Seems to work fine with gcc 8.1.1 on Fedora.
--
MST
Powered by blists - more mailing lists