[dpdk-dev] "virtual" C++ keyword used in rte_devargs.h and causes compilation error in C++

Neil Horman nhorman at tuxdriver.com
Sat Feb 7 21:23:50 CET 2015


On Fri, Feb 06, 2015 at 11:24:15PM -0800, Ming Zhao wrote:
> The code is in rte_devargs.h:
> 
> rte_devargs.h:
> 
>                 /** Used if type is RTE_DEVTYPE_VIRTUAL. */
>                 struct {
>                         /** Driver name. */
>                         char drv_name[32];
>                 } virtual;
>         };
> 
> Which caused clang compiler to report error when this file is included
> by a cpp file, the error message is:
> 
> In file included from net/dpdk/testing/base-test.cc:3:
> In file included from net/dpdk/testing/base-test.h:8:
> third-party/dpdk/lib/librte_eal/common/include/rte_devargs.h:89:5:
> error: 'virtual' can only appear on non-static
>       member functions
>                 } virtual;
>                   ^
> 
> I think we should try to pick another name for this field. I would
> suggest calling it "vdev" instead, or I'll be happy to take another name
> if someone comes with a different idea.
> 
> Thanks!
> Ming
> 
You could do that, but it seems like it shouldn't be necessecary.  Shouldn't the
solution just be to encapsulate either the header file or the #include directive
from the C++ file with extern C { }?
Neil



More information about the dev mailing list