summaryrefslogtreecommitdiff
path: root/test/test
diff options
context:
space:
mode:
authorDharmik Thakkar <dharmik.thakkar@arm.com>2018-10-26 16:43:03 -0500
committerThomas Monjalon <thomas@monjalon.net>2018-11-06 03:20:26 +0100
commit57ed574e263444928b793fff0d287121112fba84 (patch)
treea8c0382ea2306358a690c030ccc28c3862eeaaaf /test/test
parentf5a09cf019cf2f1a655c1dc7288e0595b36a13c4 (diff)
downloaddpdk-57ed574e263444928b793fff0d287121112fba84.zip
dpdk-57ed574e263444928b793fff0d287121112fba84.tar.gz
dpdk-57ed574e263444928b793fff0d287121112fba84.tar.xz
test/hash: fix build
Enable print_key_info() function compilation always. Compilation error message: 'test_hash.c: In function ‘print_key_info’: test_hash.c:90:15: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual] uint8_t *p = (uint8_t *)key; ^ cc1: all warnings being treated as errors' Fixes: af75078fece36 ("first public release") Cc: stable@dpdk.org Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Diffstat (limited to 'test/test')
-rw-r--r--test/test/test_hash.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/test/test/test_hash.c b/test/test/test_hash.c
index 6d06eb2..fe607fa 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] = { {