From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH] net/virtio-user: fix implicit int to enum conversion Date: Thu, 23 Jun 2016 13:51:14 -0700 Message-ID: <20160623135114.2bcfea3d@samsung9> References: <1466667620-67731-1-git-send-email-jianfeng.tan@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, yuanhan.liu@linux.intel.com, huawei.xie@intel.com To: Jianfeng Tan Return-path: Received: from mail-pf0-f172.google.com (mail-pf0-f172.google.com [209.85.192.172]) by dpdk.org (Postfix) with ESMTP id C727EC618 for ; Thu, 23 Jun 2016 22:51:22 +0200 (CEST) Received: by mail-pf0-f172.google.com with SMTP id h14so31988907pfe.1 for ; Thu, 23 Jun 2016 13:51:22 -0700 (PDT) In-Reply-To: <1466667620-67731-1-git-send-email-jianfeng.tan@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 23 Jun 2016 07:40:20 +0000 Jianfeng Tan wrote: > Implicit int to enum conversion is not allowed when icc is used as > the compiler. It raises the compiling error like, > /.../dpdk/drivers/net/virtio/virtio_user/vhost_user.c(257): > error #188: enumerated type mixed with another type > msg.request = req; > ^ > > The fix is simple, aka make such conversion explicit. > > Fixes: 6a84c37e3975 ("net/virtio-user: add vhost-user adapter layer") > > Signed-off-by: Jianfeng Tan > --- > drivers/net/virtio/virtio_user/vhost_user.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/virtio/virtio_user/vhost_user.c b/drivers/net/virtio/virtio_user/vhost_user.c > index 95e80f8..e2772d5 100644 > --- a/drivers/net/virtio/virtio_user/vhost_user.c > +++ b/drivers/net/virtio/virtio_user/vhost_user.c > @@ -254,7 +254,7 @@ vhost_user_sock(int vhostfd, uint64_t req, void *arg) > > PMD_DRV_LOG(INFO, "%s", vhost_msg_strings[req]); > > - msg.request = req; > + msg.request = (enum vhost_user_request)req; > msg.flags = VHOST_USER_VERSION; > msg.size = 0; > Why not just just change API, to use enum? This would move type checking out to the user.