DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] bbdev: prevent clang 3.4.2 compilation error
@ 2022-10-10 17:04 Nicolas Chautru
  2022-10-10 18:39 ` Ali Alnubani
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Chautru @ 2022-10-10 17:04 UTC (permalink / raw)
  To: thomas, dev, gakhil; +Cc: Nicolas Chautru

Casting explicitly from enum to uint8_t to avoid compilation
warning with clang 3.4.2 -Wtautological-constant-out-of-range-compare

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 lib/bbdev/rte_bbdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c
index 453e5747b6..1521cdbc53 100644
--- a/lib/bbdev/rte_bbdev.c
+++ b/lib/bbdev/rte_bbdev.c
@@ -1159,7 +1159,8 @@ rte_bbdev_device_status_str(enum rte_bbdev_device_status status)
 		"RTE_BBDEV_DEV_CORRECT_ERR",
 	};
 
-	if (status < sizeof(dev_sta_string) / sizeof(char *))
+	/* Cast from enum required for clang. */
+	if ((uint8_t)status < sizeof(dev_sta_string) / sizeof(char *))
 		return dev_sta_string[status];
 
 	rte_bbdev_log(ERR, "Invalid device status");
@@ -1176,7 +1177,8 @@ rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status)
 		"RTE_BBDEV_ENQ_STATUS_INVALID_OP",
 	};
 
-	if (status < sizeof(enq_sta_string) / sizeof(char *))
+	/* Cast from enum required for clang. */
+	if ((uint8_t)status < sizeof(enq_sta_string) / sizeof(char *))
 		return enq_sta_string[status];
 
 	rte_bbdev_log(ERR, "Invalid enqueue status");
-- 
2.37.1


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

end of thread, other threads:[~2022-10-10 23:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 17:04 [PATCH v1] bbdev: prevent clang 3.4.2 compilation error Nicolas Chautru
2022-10-10 18:39 ` Ali Alnubani
2022-10-10 23:27   ` Thomas Monjalon

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