mempool: patches
cover mempool: patches
Tried building mempool with MSVC. In addition to the __rte_constant macro Tyler had already done.
This fixes a couple of warnings, and cleans up the code.
Stephen Hemminger (2):
mempool: replace GCC pragma with cast
mempool: fix unused warning with MSVC
lib/mempool/rte_mempool.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 mempool: replace GCC pragma with cast
Building mempool with MSVC generates a warning because of this pragma (same with clang when debug is enabled). The issue the pragma was working around can be better solved by using an additional cast.
--- lib/mempool/rte_mempool.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
lib/mempool/rte_mempool.c +1 -9
@@ -1056,10 +1056,6 @@ rte_mempool_dump_cache(FILE *f, const struct rte_mempool *mp)return count; } -#ifndef __INTEL_COMPILER -#pragma GCC diagnostic ignored "-Wcast-qual" -#endif -/* check and update cookies or panic (internal) */ void rte_mempool_check_cookies (const struct rte_mempool *mp,void *const *obj_table_const,unsigned n,int free)
@@ -1074,7 +1070,7 @@ void rte_mempool_check_cookies(const struct rte_mempool *mp,/* Force to drop the "const" attribute. This is done only when * DEBUG is enabled */ - tmp = (void *) obj_table_const; + tmp = (void *)(uintptr_t )obj_table_const; obj_table = tmp;while (n--) {
@@ -1183,10 +1179,6 @@ mempool_audit_cookies(struct rte_mempool *mp)#define mempool_audit_cookies (mp) do {} while(0)#endif -#ifndef __INTEL_COMPILER -#pragma GCC diagnostic error "-Wcast-qual" -#endif -/* check cookies before and after objects */ static void mempool_audit_cache (const struct rte_mempool *mp)
Signature · 1 line
2.43.0
Re: [PATCH 1/2] mempool: replace GCC pragma with cast
Quoted 9 lines · Stephen Hemminger
Building mempool with MSVC generates a warning because of this pragma (same with clang when debug is enabled). The issue the pragma was working around can be better solved by using an additional cast.
Fixes af75078fece3 ("first public release")Signed-off-by Stephen Hemminger <[email protected]>---
PATCH 2/2 mempool: fix unused warning with MSVC
In reply to Stephen HemmingerApplying __rte_unused to a variable has no effect with MS windows compiler. The temporary variable used if debug enabled can just be eliminated.
--- lib/mempool/rte_mempool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
lib/mempool/rte_mempool.c +1 -3
@@ -164,7 +164,6 @@ mempool_add_elem(struct rte_mempool *mp, __rte_unused void *opaque, void *obj, rte_iova_t iova) {struct rte_mempool_objhdr *hdr; - struct rte_mempool_objtlr *tlr __rte_unused;/* set mempool ptr in header */ hdr =RTE_PTR_SUB (obj,sizeof (*hdr));
@@ -175,8 +174,7 @@ mempool_add_elem(struct rte_mempool *mp, __rte_unused void *opaque,#ifdef RTE_LIBRTE_MEMPOOL_DEBUG hdr->cookie =RTE_MEMPOOL_HEADER_COOKIE2 ; - tlr =rte_mempool_get_trailer (obj); - tlr->cookie =RTE_MEMPOOL_TRAILER_COOKIE ; +rte_mempool_get_trailer (obj)->cookie =RTE_MEMPOOL_TRAILER_COOKIE ;#endif }
Signature · 1 line
2.43.0
Re: [PATCH 2/2] mempool: fix unused warning with MSVC
Quoted 6 lines · Stephen Hemminger
Applying
__rte_unusedto a variable has no effect with MS windows compiler. The temporary variable used if debug enabled can just be eliminated.Signed-off-by Stephen Hemminger <[email protected]>---
Quoted 7 lines · Stephen Hemminger
Tried building mempool with MSVC. In addition to the
__rte_constantmacro Tyler had already done.This fixes a couple of warnings, and cleans up the code.
Quoted 6 lines
Stephen Hemminger (2):
mempool: replace GCC pragma with cast
mempool: fix unused warning with MSVClib/mempool/rte_mempool.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
Series applied, thanks.
Signature · 1 line
David Marchand