From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 23DE1F04; Tue, 18 Sep 2018 21:23:05 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CFF57ED1; Tue, 18 Sep 2018 12:23:03 -0700 (PDT) Received: from 2p2660v4-1.austin.arm.com (2p2660v4-1.austin.arm.com [10.118.14.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 741F13F5BD; Tue, 18 Sep 2018 12:23:03 -0700 (PDT) From: Dharmik Thakkar To: Bruce Richardson , Pablo de Lara Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com, thomas@monjalon.net, Dharmik Thakkar , stable@dpdk.org Date: Tue, 18 Sep 2018 14:22:19 -0500 Message-Id: <1537298539-31403-1-git-send-email-dharmik.thakkar@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535379969-19642-1-git-send-email-dharmik.thakkar@arm.com> References: <1535379969-19642-1-git-send-email-dharmik.thakkar@arm.com> Subject: [dpdk-dev] [PATCH v2] test/hash: solve unit test hash compilation error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2018 19:23:05 -0000 Enable print_key_info() function compilation always. Fixes: af75078fece36 ("first public release") Cc: stable@dpdk.org Suggested-by: Honnappa Nagarahalli Signed-off-by: Dharmik Thakkar Reviewed-by: Honnappa Nagarahalli Reviewed-by: Gavin Hu --- v2: * Fix checkpatch coding style issue * Add "Fixes:" tag --- test/test/test_hash.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/test/test/test_hash.c b/test/test/test_hash.c index b3db9fd10547..db6442a2b101 100644 --- a/test/test/test_hash.c +++ b/test/test/test_hash.c @@ -80,29 +80,23 @@ static uint32_t pseudo_hash(__attribute__((unused)) const void *keys, return 3; } +#define UNIT_TEST_HASH_VERBOSE 0 /* * Print out result of unit test hash operation. */ -#if defined(UNIT_TEST_HASH_VERBOSE) static void print_key_info(const char *msg, const struct flow_key *key, int32_t pos) { - uint8_t *p = (uint8_t *)key; - unsigned i; - - printf("%s key:0x", msg); - for (i = 0; i < sizeof(struct flow_key); i++) { - printf("%02X", p[i]); + if (UNIT_TEST_HASH_VERBOSE) { + const uint8_t *p = (const uint8_t *)key; + unsigned int i; + + printf("%s key:0x", msg); + for (i = 0; i < sizeof(struct flow_key); i++) + printf("%02X", p[i]); + printf(" @ pos %d\n", pos); } - printf(" @ pos %d\n", pos); -} -#else -static void print_key_info(__attribute__((unused)) const char *msg, - __attribute__((unused)) const struct flow_key *key, - __attribute__((unused)) int32_t pos) -{ } -#endif /* Keys used by unit test functions */ static struct flow_key keys[5] = { { -- 2.7.4