Skip to contentSkip to conversation

warnings when including DPDK headers from a C++17 source file

DISCUSSION Montorsi, Francesco 2 participants 3 messages Jul 13, 2018 – Jul 15, 2018

lore
Share & tools
lore
#0 lore raw

Hi all,

I just noticed that, because of the removal of the "register" keyword in C++17, when I compile my DPDK-enabled code with -std=c++17 I get the following:

In file included from ../../../Third-Party/cpp-libs/dpdk/include/rte_ether.h:53:0,

                 from ../../../Third-Party/cpp-libs/dpdk/include/rte_ethdev.h:186,
                 from HwEmulCaptureDPDK.cpp:43:
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h: In function 'uint16_t rte_arch_bswap16(uint16_t)':
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h:57:20: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister]
  register uint16_t x = _x;
                    ^
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h: In function 'uint32_t rte_arch_bswap32(uint32_t)':
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h:72:20: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister]
  register uint32_t x = _x;
                    ^
In file included from ../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h:121:0,
                 from ../../../Third-Party/cpp-libs/dpdk/include/rte_ether.h:53,
                 from ../../../Third-Party/cpp-libs/dpdk/include/rte_ethdev.h:186,
                 from HwEmulCaptureDPDK.cpp:43:
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder_64.h: In function 'uint64_t rte_arch_bswap64(uint64_t)':
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder_64.h:52:20: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister]
  register uint64_t x = _x;
                    ^

?Just thought to let you know... that's a small issue for me since I'm using -Werror

Thanks,
Francesco

#1 lore raw
Quoted 28 lines · Francesco

Hi all,

I just noticed that, because of the removal of the "register" keyword in C++17, when I compile my DPDK-enabled code with -std=c++17 I get the following:

In file included from ../../../Third-Party/cpp-libs/dpdk/include/rte_ether.h:53:0,

                 from ../../../Third-Party/cpp-libs/dpdk/include/rte_ethdev.h:186,
                 from HwEmulCaptureDPDK.cpp:43:
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h: In function 'uint16_t rte_arch_bswap16(uint16_t)':
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h:57:20: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister]
  register uint16_t x = _x;
                    ^
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h: In function 'uint32_t rte_arch_bswap32(uint32_t)':
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h:72:20: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister]
  register uint32_t x = _x;
                    ^
In file included from ../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder.h:121:0,
                 from ../../../Third-Party/cpp-libs/dpdk/include/rte_ether.h:53,
                 from ../../../Third-Party/cpp-libs/dpdk/include/rte_ethdev.h:186,
                 from HwEmulCaptureDPDK.cpp:43:
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder_64.h: In function 'uint64_t rte_arch_bswap64(uint64_t)':
../../../Third-Party/cpp-libs/dpdk/include/rte_byteorder_64.h:52:20: warning: ISO C++1z does not allow 'register' storage class specifier [-Wregister]
  register uint64_t x = _x;
                    ^
Quoted 7 lines

?Just thought to let you know... that's a small issue for me since I'm using -Werror

Thanks,
Francesco

Why is DPDK code using register keyword at all? It is ignored by modern compilers.

#2 lore raw

Hi,

________________________________________
From: Stephen Hemminger <[email protected]>
Sent: Friday, July 13, 2018 5:52 PM
To: Montorsi, Francesco
Cc: [email protected]
Subject: Re: [dpdk-dev] warnings when including DPDK headers from a C++17 source file

Quoted 1 line

Why is DPDK code using register keyword at all? It is ignored by modern compilers.

that's my question as well :)

Maybe register keyword could be removed at least from header files to make the life easier to whoever is using C++17... right now I worked around that by placing -Werror -Wno-register, but that's perhaps not the best solution

Francesco