patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v2] test/hash: solve unit test hash compilation error
       [not found] <1535379969-19642-1-git-send-email-dharmik.thakkar@arm.com>
@ 2018-09-18 19:22 ` Dharmik Thakkar
  2018-10-01 20:04   ` Honnappa Nagarahalli
  2018-10-26 21:43   ` [dpdk-stable] [PATCH v3] " Dharmik Thakkar
  0 siblings, 2 replies; 4+ messages in thread
From: Dharmik Thakkar @ 2018-09-18 19:22 UTC (permalink / raw)
  To: Bruce Richardson, Pablo de Lara
  Cc: dev, honnappa.nagarahalli, thomas, Dharmik Thakkar, stable

Enable print_key_info() function compilation always.

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

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

* Re: [dpdk-stable] [PATCH v2] test/hash: solve unit test hash compilation error
  2018-09-18 19:22 ` [dpdk-stable] [PATCH v2] test/hash: solve unit test hash compilation error Dharmik Thakkar
@ 2018-10-01 20:04   ` Honnappa Nagarahalli
  2018-10-26 21:43   ` [dpdk-stable] [PATCH v3] " Dharmik Thakkar
  1 sibling, 0 replies; 4+ messages in thread
From: Honnappa Nagarahalli @ 2018-10-01 20:04 UTC (permalink / raw)
  To: Dharmik Thakkar, Bruce Richardson, Pablo de Lara
  Cc: dev, thomas, Dharmik Thakkar, stable, nd

> 
> Enable print_key_info() function compilation always.
> 
> 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>
> ---
> 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
Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

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

* [dpdk-stable] [PATCH v3] test/hash: solve unit test hash compilation error
  2018-09-18 19:22 ` [dpdk-stable] [PATCH v2] test/hash: solve unit test hash compilation error Dharmik Thakkar
  2018-10-01 20:04   ` Honnappa Nagarahalli
@ 2018-10-26 21:43   ` Dharmik Thakkar
  2018-11-06  2:19     ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Dharmik Thakkar @ 2018-10-26 21:43 UTC (permalink / raw)
  To: dev, Bruce Richardson, Pablo de Lara; +Cc: Dharmik Thakkar, stable

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>
---
v3:
* Add compilation error message
---
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

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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] test/hash: solve unit test hash compilation error
  2018-10-26 21:43   ` [dpdk-stable] [PATCH v3] " Dharmik Thakkar
@ 2018-11-06  2:19     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2018-11-06  2:19 UTC (permalink / raw)
  To: Dharmik Thakkar; +Cc: dev, Bruce Richardson, Pablo de Lara, stable

26/10/2018 23:43, Dharmik Thakkar:
> 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>

Applied, thanks

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

end of thread, other threads:[~2018-11-06  2:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1535379969-19642-1-git-send-email-dharmik.thakkar@arm.com>
2018-09-18 19:22 ` [dpdk-stable] [PATCH v2] test/hash: solve unit test hash compilation error Dharmik Thakkar
2018-10-01 20:04   ` Honnappa Nagarahalli
2018-10-26 21:43   ` [dpdk-stable] [PATCH v3] " Dharmik Thakkar
2018-11-06  2:19     ` [dpdk-stable] [dpdk-dev] " 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).