On 4/10/2019 10:36 PM, David Christensen wrote:
> The function eth_dev_pci_specific_init is missing a typecast to
> (struct rte_pci_device *) for the input argument bus_device.
> This causes build issues in the GNU C++ compiler.
> 
> [CXX]       g++ -o utils/pcap_handle.o -c utils/pcap_handle.cc -g3·
> -ggdb3 -mcpu=native -mtune=native -isystem·
> /home/rchirra/gen/io/ppc64include -std=gnu++11 -flax-vector-conversions·
> -Werror -isystem /home/rchirra/gen/io
> 
> In file included from drivers/pmd.cc:7:0:
> /home/rchirra/gen/io/deps/dpdk/build/include/rte_ethdev_pci.h:
> In function ‘int eth_dev_pci_specific_init(rte_eth_dev*, void*)’:
> /home/rchirra/gen/io/deps/dpdk/build/include/rte_ethdev_pci.h:75:35:·
> error: invalid conversion from ‘void*’ to ‘rte_pci_device*’
> [-fpermissive]
>   struct rte_pci_device *pci_dev = bus_device;
>                                    ^~~~~~~~~~
> make[1]: *** [drivers/pmd.o] Error 1
> 
> $ g++ --version
> g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

This problem is while building a driver with c++ compiler, but since the
solution is a simple casting, which doesn't have any side affect, I am for
getting the patch, any objection?

> 
> Cc: sta...@dpdk.org
> 
> Signed-off-by: David Christensen <d...@linux.vnet.ibm.com>
> Tested-by: Radhika Chirra <radhika.chi...@ibm.com>
> ---
> v2:
> * Mmodified subject line to indicate a C++ compiler issue
> * Added error output from the compiler
> 
>  lib/librte_ethdev/rte_ethdev_pci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ethdev/rte_ethdev_pci.h 
> b/lib/librte_ethdev/rte_ethdev_pci.h
> index 23257e9..a325311 100644
> --- a/lib/librte_ethdev/rte_ethdev_pci.h
> +++ b/lib/librte_ethdev/rte_ethdev_pci.h
> @@ -72,7 +72,7 @@
>  
>  static inline int
>  eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) {
> -     struct rte_pci_device *pci_dev = bus_device;
> +     struct rte_pci_device *pci_dev = (struct rte_pci_device *)bus_device;
>  
>       if (!pci_dev)
>               return -ENODEV;
> 

Reply via email to