DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/2] mempool: patches
@ 2024-04-01 17:01 Stephen Hemminger
  2024-04-01 17:01 ` [PATCH 1/2] mempool: replace GCC pragma with cast Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stephen Hemminger @ 2024-04-01 17:01 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

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(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] mempool: replace GCC pragma with cast
  2024-04-01 17:01 [PATCH 0/2] mempool: patches Stephen Hemminger
@ 2024-04-01 17:01 ` Stephen Hemminger
  2024-04-01 17:21   ` Tyler Retzlaff
  2024-04-01 17:01 ` [PATCH 2/2] mempool: fix unused warning with MSVC Stephen Hemminger
  2024-06-14 14:25 ` [PATCH 0/2] mempool: patches David Marchand
  2 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2024-04-01 17:01 UTC (permalink / raw)
  To: dev; +Cc: 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 <stephen@networkplumber.org>
---
 lib/mempool/rte_mempool.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
index 12390a2c81..734e8a2feb 100644
--- a/lib/mempool/rte_mempool.c
+++ b/lib/mempool/rte_mempool.c
@@ -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)
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] mempool: fix unused warning with MSVC
  2024-04-01 17:01 [PATCH 0/2] mempool: patches Stephen Hemminger
  2024-04-01 17:01 ` [PATCH 1/2] mempool: replace GCC pragma with cast Stephen Hemminger
@ 2024-04-01 17:01 ` Stephen Hemminger
  2024-04-01 17:22   ` Tyler Retzlaff
  2024-06-14 14:25 ` [PATCH 0/2] mempool: patches David Marchand
  2 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2024-04-01 17:01 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

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(-)

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
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] mempool: replace GCC pragma with cast
  2024-04-01 17:01 ` [PATCH 1/2] mempool: replace GCC pragma with cast Stephen Hemminger
@ 2024-04-01 17:21   ` Tyler Retzlaff
  0 siblings, 0 replies; 6+ messages in thread
From: Tyler Retzlaff @ 2024-04-01 17:21 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Mon, Apr 01, 2024 at 10:01:52AM -0700, Stephen Hemminger wrote:
> 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 <stephen@networkplumber.org>
> ---

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mempool: fix unused warning with MSVC
  2024-04-01 17:01 ` [PATCH 2/2] mempool: fix unused warning with MSVC Stephen Hemminger
@ 2024-04-01 17:22   ` Tyler Retzlaff
  0 siblings, 0 replies; 6+ messages in thread
From: Tyler Retzlaff @ 2024-04-01 17:22 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

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>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] mempool: patches
  2024-04-01 17:01 [PATCH 0/2] mempool: patches Stephen Hemminger
  2024-04-01 17:01 ` [PATCH 1/2] mempool: replace GCC pragma with cast Stephen Hemminger
  2024-04-01 17:01 ` [PATCH 2/2] mempool: fix unused warning with MSVC Stephen Hemminger
@ 2024-06-14 14:25 ` David Marchand
  2 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2024-06-14 14:25 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Tyler Retzlaff

On Mon, Apr 1, 2024 at 7:03 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> 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(-)

Series applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-14 14:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-01 17:01 [PATCH 0/2] mempool: patches Stephen Hemminger
2024-04-01 17:01 ` [PATCH 1/2] mempool: replace GCC pragma with cast Stephen Hemminger
2024-04-01 17:21   ` Tyler Retzlaff
2024-04-01 17:01 ` [PATCH 2/2] mempool: fix unused warning with MSVC Stephen Hemminger
2024-04-01 17:22   ` Tyler Retzlaff
2024-06-14 14:25 ` [PATCH 0/2] mempool: patches David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).