From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 07F01A0544; Mon, 10 Oct 2022 19:04:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9EFE54021D; Mon, 10 Oct 2022 19:04:30 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 55C1C40041 for ; Mon, 10 Oct 2022 19:04:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665421468; x=1696957468; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=EyPPPh1fawYfrAupQFZWVVIarN1lZHEBkZYsBlf8f+c=; b=Jcj0UPvEwm3/+tX5NRLLMghuB+8GyFCQHdXEBbpQS72WJdljx9c1dW10 wS/T0ELP9hk1jgHRvfdVJcaEsVHvsHflBUuzIO8/ZogEs81sS4n5idYsx mkrBChmVSmyaTHE27EEbbyFWULw/s4l3uoOTKqNfQWok/hUJrZUma3LAw /SEAj81K//ctcscq9LoYrao74rvQ2bisjTL3o0cKkXcki4T4Nc4FkZ0aZ FLnWn+m05aWWHC5VYoBNfB4jLshBnyhLP7VcgPjy0JskX5WeqycfJe9o7 qwDHq+aSolxOUO1qxgVNwar4U+rvArjoxL0oczyQxaAtbQI56CqrH4UZG A==; X-IronPort-AV: E=McAfee;i="6500,9779,10496"; a="284009773" X-IronPort-AV: E=Sophos;i="5.95,173,1661842800"; d="scan'208";a="284009773" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 10:04:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10496"; a="577120222" X-IronPort-AV: E=Sophos;i="5.95,173,1661842800"; d="scan'208";a="577120222" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga003.jf.intel.com with ESMTP; 10 Oct 2022 10:04:24 -0700 From: Nicolas Chautru To: thomas@monjalon.net, dev@dpdk.org, gakhil@marvell.com Cc: Nicolas Chautru Subject: [PATCH v1] bbdev: prevent clang 3.4.2 compilation error Date: Mon, 10 Oct 2022 10:04:03 -0700 Message-Id: <20221010170403.21201-1-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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