DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andy Green <andy@warmcat.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 09/24] rte_ring.h: remove signed type flipflopping
Date: Fri, 11 May 2018 09:59:39 +0800	[thread overview]
Message-ID: <152600397975.54839.7981692414118296901.stgit@localhost.localdomain> (raw)
In-Reply-To: <152600382101.54839.18392182958431211001.stgit@localhost.localdomain>

/projects/lagopus/src/dpdk/build/include/rte_ring.h:350:46:
warning: conversion to 'uint32_t' {aka 'unsigned int'}
from 'int' may change the sign of the result
[-Wsign-conversion]
  update_tail(&r->prod, prod_head, prod_next, is_sp, 1);

The visible apis take unsigned int, then call a private
api taking an int, which finally calls an api taking an
unsigned int.

Convert the private api to take unsigned int removing
5 x warning similar to that shown above.

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_ring/rte_ring.h         |    4 ++--
 lib/librte_ring/rte_ring_c11_mem.h |    2 +-
 lib/librte_ring/rte_ring_generic.h |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index d3d3f7f97..124582251 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -335,7 +335,7 @@ void rte_ring_dump(FILE *f, const struct rte_ring *r);
 static __rte_always_inline unsigned int
 __rte_ring_do_enqueue(struct rte_ring *r, void * const *obj_table,
 		 unsigned int n, enum rte_ring_queue_behavior behavior,
-		 int is_sp, unsigned int *free_space)
+		 unsigned int is_sp, unsigned int *free_space)
 {
 	uint32_t prod_head, prod_next;
 	uint32_t free_entries;
@@ -377,7 +377,7 @@ __rte_ring_do_enqueue(struct rte_ring *r, void * const *obj_table,
 static __rte_always_inline unsigned int
 __rte_ring_do_dequeue(struct rte_ring *r, void **obj_table,
 		 unsigned int n, enum rte_ring_queue_behavior behavior,
-		 int is_sc, unsigned int *available)
+		 unsigned int is_sc, unsigned int *available)
 {
 	uint32_t cons_head, cons_next;
 	uint32_t entries;
diff --git a/lib/librte_ring/rte_ring_c11_mem.h b/lib/librte_ring/rte_ring_c11_mem.h
index 08825ea5b..cb3f82b1a 100644
--- a/lib/librte_ring/rte_ring_c11_mem.h
+++ b/lib/librte_ring/rte_ring_c11_mem.h
@@ -51,7 +51,7 @@ update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
  *   If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only.
  */
 static __rte_always_inline unsigned int
-__rte_ring_move_prod_head(struct rte_ring *r, int is_sp,
+__rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,
 		unsigned int n, enum rte_ring_queue_behavior behavior,
 		uint32_t *old_head, uint32_t *new_head,
 		uint32_t *free_entries)
diff --git a/lib/librte_ring/rte_ring_generic.h b/lib/librte_ring/rte_ring_generic.h
index c2d482bc9..ea7dbe5b9 100644
--- a/lib/librte_ring/rte_ring_generic.h
+++ b/lib/librte_ring/rte_ring_generic.h
@@ -53,7 +53,7 @@ update_tail(struct rte_ring_headtail *ht, uint32_t old_val, uint32_t new_val,
  *   If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only.
  */
 static __rte_always_inline unsigned int
-__rte_ring_move_prod_head(struct rte_ring *r, int is_sp,
+__rte_ring_move_prod_head(struct rte_ring *r, unsigned int is_sp,
 		unsigned int n, enum rte_ring_queue_behavior behavior,
 		uint32_t *old_head, uint32_t *new_head,
 		uint32_t *free_entries)
@@ -123,7 +123,7 @@ __rte_ring_move_prod_head(struct rte_ring *r, int is_sp,
  *     If behavior == RTE_RING_QUEUE_FIXED, this will be 0 or n only.
  */
 static __rte_always_inline unsigned int
-__rte_ring_move_cons_head(struct rte_ring *r, int is_sc,
+__rte_ring_move_cons_head(struct rte_ring *r, unsigned int is_sc,
 		unsigned int n, enum rte_ring_queue_behavior behavior,
 		uint32_t *old_head, uint32_t *new_head,
 		uint32_t *entries)

  parent reply	other threads:[~2018-05-11  1:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11  1:58 [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Andy Green
2018-05-11  1:58 ` [dpdk-dev] [PATCH v2 01/24] lib/librte_eal: import libbsd strlcpy Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 02/24] lib/librte_ethdev: change eth-dev-ops API to return int Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 03/24] rte_common.h: cast gcc builtin result to avoid complaints Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 04/24] lib/librte_eal: explicit tmp cast Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 05/24] lib/librte_eal: explicit cast for signed change Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 06/24] /lib/librte_eal: stage cast from uint64 to long Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 07/24] rte_spinlock.h: stack declarations before code Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 08/24] rte_ring_generic.h: " Andy Green
2018-05-11  1:59 ` Andy Green [this message]
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 10/24] rte_dev.h: stack declaration at top of own basic block Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 11/24] rte_mbuf.h: avoid warnings from inadvertant promotion Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 12/24] rte_mbuf.h: explicit casts for int16 to uint16 Andy Green
2018-05-11  1:59 ` [dpdk-dev] [PATCH v2 13/24] rte_mbuf.h: make sure RTE-MIN compares same types Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 14/24] rte_mbuf.h: explicit cast restricting ptrdiff to uint16 Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 15/24] rte_mbuf.h: explicit cast for size type to uint32 Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 16/24] rte_mbuf.h: explicit casts to uint16 to avoid warnings Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 17/24] rte_byteorder.h: explicit cast for return promotion Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 18/24] rte_ether.h: explicit cast avoiding truncation warning Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 19/24] rte_ether.h: stack vars declared at top of function Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 20/24] rte_ethdev.h: align sign and scope of temp var Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 21/24] rte_ethdev.h: explicit cast for truncation Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 22/24] rte_hash_crc.h: stack vars declared at top of function Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 23/24] rte_hash_crc.h: explicit casts for truncation Andy Green
2018-05-11  2:00 ` [dpdk-dev] [PATCH v2 24/24] test_table_pipeline: repair munged indirection level Andy Green
2018-05-11  3:04 ` [dpdk-dev] [PATCH v2 00/24] Fixes for GCC8 against lagopus Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152600397975.54839.7981692414118296901.stgit@localhost.localdomain \
    --to=andy@warmcat.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).