[2/2] mempool: fix unused warning with MSVC

Message ID 20240401170257.121047-3-stephen@networkplumber.org (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers
Series mempool: patches |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-abi-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing fail Testing issues
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Stephen Hemminger April 1, 2024, 5:01 p.m. UTC
  Applying __rte_unused to 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 <stephen@networkplumber.org>
---
 lib/mempool/rte_mempool.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Comments

Tyler Retzlaff April 1, 2024, 5:22 p.m. UTC | #1
On Mon, Apr 01, 2024 at 10:01:53AM -0700, Stephen Hemminger wrote:
> Applying __rte_unused to 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 <stephen@networkplumber.org>
> ---
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  

Patch

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 734e8a2feb..2ac815a3bb 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -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
 }