From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f179.google.com (mail-ig0-f179.google.com [209.85.213.179]) by dpdk.org (Postfix) with ESMTP id AF3D83772 for ; Sun, 25 Oct 2015 13:06:54 +0100 (CET) Received: by igdg1 with SMTP id g1so42370792igd.1 for ; Sun, 25 Oct 2015 05:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=9zZJGSaURHk1v6WmI4RkRnwX/SvapIND+X7z0G3R4AU=; b=NonL6Wt3Wvq45Qi4DCoohnn4kJQQhBI3gpbGQt+MrfW8PwTCJ1zf0b1gUIkHHodbby FwfpKaOEa5HNenWiB7rT5Qbeg4enu/XvK6tEGNFTTrYIS5QIf6qlOKTDgpf4DeqA6AEz DjVnF8scWZlGaWRNIHQGmNciqK/4MAtcKnR0iBorXB/2zkAb70ymdnuhWRXoan83B0XZ hJKdE/UevkZwHo1Z6T8NhouhiOBkKaOEfeIgYbj50WPDYP59EPk0z2kzeg1ylrlP3ndU SwEyBYfv23HrEYhzjAe6qm8a/YMjPG2a+KyNmcqL4noVmy3Mwx71wEjLz7fCnxSJFrLv HfNA== MIME-Version: 1.0 X-Received: by 10.50.55.42 with SMTP id o10mr13722531igp.11.1445774814124; Sun, 25 Oct 2015 05:06:54 -0700 (PDT) Received: by 10.79.109.202 with HTTP; Sun, 25 Oct 2015 05:06:54 -0700 (PDT) Date: Sun, 25 Oct 2015 13:06:54 +0100 Message-ID: From: Marc Sune To: dev@dpdk.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] C++ 98/03 rte_cpuflags.h compilation broken 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: Sun, 25 Oct 2015 12:06:55 -0000 During the revision of an application I maintain that is currently using DPDK v1.7.1 and about to port it to 2.1.0, I realised that 2.1.0rc4 and above (at least) are broken when compiling applications without C++11 support: In file included from /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/rte_cpuflags.h:46:0, from /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/rte_spinlock.h:43, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/../../../pipeline-imp/packet_inline.h:26, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/../../../pipeline-imp/packet.h:14, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/of1x_driver.cc:13: /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/generic/rte_cpuflags.h:53:6: error: use of enum 'rte_cpu_flag_t' without previous declaration enum rte_cpu_flag_t __RTE_CPUFLAG_UNDERLYING_TYPE; ^ /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/generic/rte_cpuflags.h:58:6: error: use of enum 'cpu_register_t' without previous declaration enum cpu_register_t __RTE_REGISTER_UNDERLYING_TYPE; ^ /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/generic/rte_cpuflags.h:107:31: error: use of enum 'rte_cpu_flag_t' without previous declaration rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); ^ In file included from /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/rte_spinlock.h:43:0, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/../../../pipeline-imp/packet_inline.h:26, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/../../../pipeline-imp/packet.h:14, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/of1x_driver.cc:13: /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/rte_cpuflags.h: In function 'int rte_cpu_get_flag_enabled(rte_cpu_flag_t)': /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/rte_cpuflags.h:278:53: error: conflicting declaration of C function 'int rte_cpu_get_flag_enabled(rte_cpu_flag_t)' rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) ^ In file included from /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/rte_cpuflags.h:46:0, from /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/rte_spinlock.h:43, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/../../../pipeline-imp/packet_inline.h:26, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/../../../pipeline-imp/packet.h:14, from ../../../../../../../../../src/xdpd/drivers/gnu_linux_dpdk/src/hal-imp/open= flow/openflow1x/of1x_driver.cc:13: /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/generic/rte_cpuflags.h:107:1: note: previous declaration 'int rte_cpu_get_flag_enabled(int)' rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); ^ /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/generic/rte_cpuflags.h: At global scope: /home/marc/personal/xdpd/build/src/xdpd/drivers/gnu_linux_dpdk/../../../../= /libs/dpdk/build/include/generic/rte_cpuflags.h:107:1: error: 'int rte_cpu_get_flag_enabled(int)' declared 'static' but never defined [-Werror=3Dunused-function] There was a commit from J. Kim: commit 621389bbbe0860d41538aeac893b6d74e714530c Author: Joongi Kim Date: Fri Jul 3 21:51:03 2015 +0900 eal: fix C++ app build * Forward declaration of enum in C++ requires explicit underlying type definitions. * This fixes the issue at: http://dpdk.org/ml/archives/dev/2015-April/017065.html include/generic/rte_cpuflags.h:50:6: error: use of enum =E2=80=98rte_cpu_flag_t=E2=80=99 without previous de= claration enum rte_cpu_flag_t; include/generic/rte_cpuflags.h:55:6: error: use of enum =E2=80=98cpu_register_t=E2=80=99 without previous de= claration enum cpu_register_t; Signed-off-by: Joongi Kim [Thomas: fix extended to ppc and tile] that partially addresses the compilation of rte_cpuflags.h in C++, but only works for C++11 and above. A solution could be to make dpdk/lib/librte_eal/common/include/generic/rte_cpuflags.h conditionally include the right arch dependent rte_cpuflags.h depending on the rte_config.h ARCH variable, and move the prototype of this function there, after the (real) enum decl: 101 /** 102 * Function for checking a CPU flag availability 103 * 104 * @param feature 105 * CPU flag to query CPU for 106 * @return 107 * 1 if flag is available 108 * 0 if flag is not available 109 * -ENOENT if flag is invalid 110 */ 111 static inline int 112 rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); Converting rte_cpu_get_flag_enabled() argument into an int and typecast is worse, IMHO. Thoughts? marc