[1/2] mempool: replace GCC pragma with cast
Checks
Commit Message
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(-)
Comments
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>
@@ -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)