From: Nicolas Chautru <nicolas.chautru@intel.com>
To: thomas@monjalon.net, dev@dpdk.org, gakhil@marvell.com
Cc: Nicolas Chautru <nicolas.chautru@intel.com>
Subject: [PATCH v1] bbdev: prevent clang 3.4.2 compilation error
Date: Mon, 10 Oct 2022 10:04:03 -0700 [thread overview]
Message-ID: <20221010170403.21201-1-nicolas.chautru@intel.com> (raw)
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
next reply other threads:[~2022-10-10 17:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 17:04 Nicolas Chautru [this message]
2022-10-10 18:39 ` Ali Alnubani
2022-10-10 23:27 ` Thomas Monjalon
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=20221010170403.21201-1-nicolas.chautru@intel.com \
--to=nicolas.chautru@intel.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=thomas@monjalon.net \
/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).