Skip to contentSkip to conversation

eal: remove register from function parameter in headers

PATCH Applied Stephen Hemminger 4 participants 4 messages May 8, 2020 – May 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: remove register from function parameter in headers

Compiling a C++ application that includes directly or indirectly rte_common.h will cause a warning:

include/rte_common.h:350:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
rte_combine32ms1b(register uint32_t x)

C++ pickier than standard C and flags this antique usage.

This is a bugfix please apply to 20.05.
The register keyword is an old K&R legacy and should be removed everywhere in DPDK. For now, fix it where it hurts. Checkpatch should also be able to flag use of register keyword.

Fixes 08f683174e94 ("eal: add functions for previous power of 2 alignment")

---

 lib/librte_eal/include/rte_common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_eal/include/rte_common.h +2 -2
index 668e8b0af87d..0843ce69e7ec 100644
@@ -409,7 +409,7 @@ __extension__ typedef uint64_t RTE_MARKER64[0];
  *    The combined value.
  */
 static inline uint32_t
-rte_combine32ms1b(register uint32_t x)
+rte_combine32ms1b(uint32_t x)
 {
 	x |= x >> 1;
 	x |= x >> 2;
@@ -431,7 +431,7 @@ rte_combine32ms1b(register uint32_t x)
  *    The combined value.
  */
 static inline uint64_t
-rte_combine64ms1b(register uint64_t v)
+rte_combine64ms1b(uint64_t v)
 {
 	v |= v >> 1;
 	v |= v >> 2;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 13 lines · Stephen Hemminger

Compiling a C++ application that includes directly or indirectly rte_common.h will cause a warning:

include/rte_common.h:350:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
rte_combine32ms1b(register uint32_t x)

C++ pickier than standard C and flags this antique usage.

This is a bugfix please apply to 20.05.
The register keyword is an old K&R legacy and should be removed everywhere in DPDK. For now, fix it where it hurts. Checkpatch should also be able to flag use of register keyword.

Quoted 4 lines
Fixes 08f683174e94 ("eal: add functions for previous power of 2 alignment")

---

I remember similar patches already being submitted, and the community has decided that 'register' keyword was worth keeping (although i don't recall the reasoning). Has something changed since then?

Signature · 2 lines
Thanks,
Anatoly
#2 lore raw
Quoted 14 lines · Anatoly
Quoted 13 lines · Stephen Hemminger

Compiling a C++ application that includes directly or indirectly rte_common.h will cause a warning:

include/rte_common.h:350:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
rte_combine32ms1b(register uint32_t x)

C++ pickier than standard C and flags this antique usage.

This is a bugfix please apply to 20.05.
The register keyword is an old K&R legacy and should be removed everywhere in DPDK. For now, fix it where it hurts. Checkpatch should also be able to flag use of register keyword.

Quoted 9 lines
Quoted 4 lines
Fixes 08f683174e94 ("eal: add functions for previous power of 2 alignment")

---

I remember similar patches already being submitted, and the community has decided that 'register' keyword was worth keeping (although i don't recall the reasoning). Has something changed since then?

I'm not sure anything has changed - and I don't see the need for register keyword myself - but all headers must be includable in C++ code. Therefore we need to remove register from rte_common.h

#3 lore raw
Quoted 9 lines · Bruce Richardson
Quoted 7 lines · Anatoly
Quoted 6 lines · Stephen Hemminger

Compiling a C++ application that includes directly or indirectly rte_common.h will cause a warning:

include/rte_common.h:350:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
rte_combine32ms1b(register uint32_t x)

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

C++ pickier than standard C and flags this antique usage.

This is a bugfix please apply to 20.05.
The register keyword is an old K&R legacy and should be removed everywhere in DPDK. For now, fix it where it hurts. Checkpatch should also be able to flag use of register keyword.

Fixes 08f683174e94 ("eal: add functions for previous power of 2 alignment")
Quoted 2 lines
Quoted 1 line
Quoted 1 line

Applied, thanks.

Signature · 1 line
David Marchand