From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by dpdk.org (Postfix) with ESMTP id CA48D567A for ; Sat, 26 Sep 2015 15:33:25 +0200 (CEST) Received: by lahh2 with SMTP id h2so121742155lah.0 for ; Sat, 26 Sep 2015 06:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:date:subject:to; bh=dnfc4npb/2se1XaGZqAEuWHIAfDvPVHD5ZgOhe36Dk4=; b=Z0mWKR3TfNtQPrCipfp8KravQjQ3bh38/590fdNjw2Cx4HRXHX6s7stKijuPLPTyfp YEKJ7zim59M+Q58tbUlUtoO5lkJs2SGzHwzZDnxm6dZfnb07oq9zRE1cg0qg+9Lru4kY NrR5R6F6ZjEIdTJGkVWFBkOtGynLI3uy7e+WnhAgjiELR2+8B7TBUJrwCznlP3yHrSQ7 KuMV+hMVz0I+/aI6Xz0sAxY0ee1ZQIEn3uMv9JO8GhGR3/pVQaZOO2O5lEi1KWtaRi+L NFlrdkN/eP4+pZagC5fsgmwKfUVMzyy6v4p4XXSVHqkxeu1o5dXwKBeTabDS/kapsiyZ TIVA== X-Received: by 10.152.37.135 with SMTP id y7mr516460laj.110.1443274405366; Sat, 26 Sep 2015 06:33:25 -0700 (PDT) Received: from localhost (188-67-107-13.bb.dnainternet.fi. [188.67.107.13]) by smtp.gmail.com with ESMTPSA id ba7sm951526lbc.48.2015.09.26.06.33.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Sep 2015 06:33:24 -0700 (PDT) Message-ID: <56069ea4.47ac700a.ca875.43bb@mx.google.com> Received: by localhost (sSMTP sendmail emulation); Sat, 26 Sep 2015 16:33:22 +0300 From: Christoph Gysin Date: Sat, 26 Sep 2015 16:09:41 +0300 To: dev@dpdk.org Subject: [dpdk-dev] [PATCH] eal: fix C++ build (struct member: virtual) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Sep 2015 13:33:26 -0000 'virtual' is a keyword and can't be used if the code is to compile with C++ compilers. If rte_devargs.h was included in C++ code, compilation with clang++ failed with an error. g++ did not fail, but only because of a bug that treats it as an anonymous struct with a decl-specifier which it ignores. This simply renames the member to 'virt'. --- lib/librte_eal/common/eal_common_dev.c | 4 ++-- lib/librte_eal/common/eal_common_devargs.c | 8 ++++---- lib/librte_eal/common/include/rte_devargs.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 4089d66..a8a4146 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -107,10 +107,10 @@ rte_eal_dev_init(void) if (devargs->type != RTE_DEVTYPE_VIRTUAL) continue; - if (rte_eal_vdev_init(devargs->virtual.drv_name, + if (rte_eal_vdev_init(devargs->virt.drv_name, devargs->args)) { RTE_LOG(ERR, EAL, "failed to initialize %s device\n", - devargs->virtual.drv_name); + devargs->virt.drv_name); return -1; } } diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index ec56165..5d075d0 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -107,9 +107,9 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) break; case RTE_DEVTYPE_VIRTUAL: /* save driver name */ - ret = snprintf(devargs->virtual.drv_name, - sizeof(devargs->virtual.drv_name), "%s", buf); - if (ret < 0 || ret >= (int)sizeof(devargs->virtual.drv_name)) + ret = snprintf(devargs->virt.drv_name, + sizeof(devargs->virt.drv_name), "%s", buf); + if (ret < 0 || ret >= (int)sizeof(devargs->virt.drv_name)) goto fail; break; @@ -169,7 +169,7 @@ rte_eal_devargs_dump(FILE *f) devargs->args); else if (devargs->type == RTE_DEVTYPE_VIRTUAL) fprintf(f, " VIRTUAL %s %s\n", - devargs->virtual.drv_name, + devargs->virt.drv_name, devargs->args); else fprintf(f, " UNKNOWN %s\n", devargs->args); diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h index 7084ae2..53c59f5 100644 --- a/lib/librte_eal/common/include/rte_devargs.h +++ b/lib/librte_eal/common/include/rte_devargs.h @@ -86,7 +86,7 @@ struct rte_devargs { struct { /** Driver name. */ char drv_name[32]; - } virtual; + } virt; }; /** Arguments string as given by user or "" for no argument. */ char *args; -- 2.5.3