patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] rcu: avoid literal suffix warning in C++ mode
@ 2020-08-31 21:38 Dmitry Kozlyuk
  2020-09-04  6:27 ` Honnappa Nagarahalli
  2020-09-04 20:47 ` [dpdk-stable] [PATCH v2] lib/rcu: " Dmitry Kozlyuk
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Kozlyuk @ 2020-08-31 21:38 UTC (permalink / raw)
  To: dev; +Cc: Dmitry Kozlyuk, stable, Honnappa Nagarahalli

Sequences like "value = %"PRIu64 (no space before PRIu64) are parsed as
a single preprocessor token, user-defined-string-literal, in C++11
onwards. While modern compilers are smart enough to parse this properly,
GCC 9.3.0 generates warnings like:

    rte_rcu_qsbr.h:555:26: warning: invalid suffix on literal; C++11
    requires a space between literal and string macro [-Wliteral-suffix]

Add spaces around format specifier macros to make public headers
compatible with C++ without causing warnings.

Fixes: 64994b56c ("rcu: add RCU library supporting QSBR mechanism")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/librte_rcu/rte_rcu_qsbr.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h
index a98e8f0f8..aa237cf75 100644
--- a/lib/librte_rcu/rte_rcu_qsbr.h
+++ b/lib/librte_rcu/rte_rcu_qsbr.h
@@ -552,7 +552,7 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v, unsigned int thread_id)
 		__atomic_store_n(&v->qsbr_cnt[thread_id].cnt,
 					 t, __ATOMIC_RELEASE);
 
-	__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %"PRIu64", Thread ID = %d",
+	__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %" PRIu64 ", Thread ID = %d",
 		__func__, t, thread_id);
 }
 
@@ -580,13 +580,13 @@ __rte_rcu_qsbr_check_selective(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 		while (bmap) {
 			j = __builtin_ctzl(bmap);
 			__RTE_RCU_DP_LOG(DEBUG,
-				"%s: check: token = %"PRIu64", wait = %d, Bit Map = 0x%"PRIx64", Thread ID = %d",
+				"%s: check: token = %" PRIu64 ", wait = %d, Bit Map = 0x%" PRIx64 ", Thread ID = %d",
 				__func__, t, wait, bmap, id + j);
 			c = __atomic_load_n(
 					&v->qsbr_cnt[id + j].cnt,
 					__ATOMIC_ACQUIRE);
 			__RTE_RCU_DP_LOG(DEBUG,
-				"%s: status: token = %"PRIu64", wait = %d, Thread QS cnt = %"PRIu64", Thread ID = %d",
+				"%s: status: token = %" PRIu64 ", wait = %d, Thread QS cnt = %" PRIu64 ", Thread ID = %d",
 				__func__, t, wait, c, id+j);
 
 			/* Counter is not checked for wrap-around condition
@@ -643,12 +643,12 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 
 	for (i = 0, cnt = v->qsbr_cnt; i < v->max_threads; i++, cnt++) {
 		__RTE_RCU_DP_LOG(DEBUG,
-			"%s: check: token = %"PRIu64", wait = %d, Thread ID = %d",
+			"%s: check: token = %" PRIu64 ", wait = %d, Thread ID = %d",
 			__func__, t, wait, i);
 		while (1) {
 			c = __atomic_load_n(&cnt->cnt, __ATOMIC_ACQUIRE);
 			__RTE_RCU_DP_LOG(DEBUG,
-				"%s: status: token = %"PRIu64", wait = %d, Thread QS cnt = %"PRIu64", Thread ID = %d",
+				"%s: status: token = %" PRIu64 ", wait = %d, Thread QS cnt = %" PRIu64 ", Thread ID = %d",
 				__func__, t, wait, c, i);
 
 			/* Counter is not checked for wrap-around condition
@@ -725,10 +725,10 @@ rte_rcu_qsbr_check(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 	/* Check if all the readers have already acknowledged this token */
 	if (likely(t <= v->acked_token)) {
 		__RTE_RCU_DP_LOG(DEBUG,
-			"%s: check: token = %"PRIu64", wait = %d",
+			"%s: check: token = %" PRIu64 ", wait = %d",
 			__func__, t, wait);
 		__RTE_RCU_DP_LOG(DEBUG,
-			"%s: status: least acked token = %"PRIu64"",
+			"%s: status: least acked token = %" PRIu64,
 			__func__, v->acked_token);
 		return 1;
 	}
-- 
2.25.4


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

* Re: [dpdk-stable] [PATCH] rcu: avoid literal suffix warning in C++ mode
  2020-08-31 21:38 [dpdk-stable] [PATCH] rcu: avoid literal suffix warning in C++ mode Dmitry Kozlyuk
@ 2020-09-04  6:27 ` Honnappa Nagarahalli
  2020-09-04 20:47 ` [dpdk-stable] [PATCH v2] lib/rcu: " Dmitry Kozlyuk
  1 sibling, 0 replies; 5+ messages in thread
From: Honnappa Nagarahalli @ 2020-09-04  6:27 UTC (permalink / raw)
  To: Dmitry Kozlyuk, dev; +Cc: stable, nd, Honnappa Nagarahalli, nd

Hi Dmitry,
	Thanks for the patch, few nits inline.

> -----Original Message-----
> From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Sent: Monday, August 31, 2020 4:38 PM
> To: dev@dpdk.org
> Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>; stable@dpdk.org;
> Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
> Subject: [PATCH] rcu: avoid literal suffix warning in C++ mode
                                  ^^^ should be lib/rcu
> 
> Sequences like "value = %"PRIu64 (no space before PRIu64) are parsed as a
> single preprocessor token, user-defined-string-literal, in C++11 onwards.
> While modern compilers are smart enough to parse this properly, GCC 9.3.0
> generates warnings like:
> 
>     rte_rcu_qsbr.h:555:26: warning: invalid suffix on literal; C++11
>     requires a space between literal and string macro [-Wliteral-suffix]
> 
> Add spaces around format specifier macros to make public headers
> compatible with C++ without causing warnings.
> 
> Fixes: 64994b56c ("rcu: add RCU library supporting QSBR mechanism")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---
>  lib/librte_rcu/rte_rcu_qsbr.h | 14 +++++++-------
To be consistent, can you please do similar changes in rte_rcu_qsbr.c file?

>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h
> index a98e8f0f8..aa237cf75 100644
> --- a/lib/librte_rcu/rte_rcu_qsbr.h
> +++ b/lib/librte_rcu/rte_rcu_qsbr.h
> @@ -552,7 +552,7 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v,
> unsigned int thread_id)
>  		__atomic_store_n(&v->qsbr_cnt[thread_id].cnt,
>  					 t, __ATOMIC_RELEASE);
> 
> -	__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %"PRIu64",
> Thread ID = %d",
> +	__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %" PRIu64 ",
> Thread ID =
> +%d",
>  		__func__, t, thread_id);
>  }
> 
> @@ -580,13 +580,13 @@ __rte_rcu_qsbr_check_selective(struct
> rte_rcu_qsbr *v, uint64_t t, bool wait)
>  		while (bmap) {
>  			j = __builtin_ctzl(bmap);
>  			__RTE_RCU_DP_LOG(DEBUG,
> -				"%s: check: token = %"PRIu64", wait = %d, Bit
> Map = 0x%"PRIx64", Thread ID = %d",
> +				"%s: check: token = %" PRIu64 ", wait = %d,
> Bit Map = 0x%" PRIx64
> +", Thread ID = %d",
>  				__func__, t, wait, bmap, id + j);
>  			c = __atomic_load_n(
>  					&v->qsbr_cnt[id + j].cnt,
>  					__ATOMIC_ACQUIRE);
>  			__RTE_RCU_DP_LOG(DEBUG,
> -				"%s: status: token = %"PRIu64", wait = %d,
> Thread QS cnt = %"PRIu64", Thread ID = %d",
> +				"%s: status: token = %" PRIu64 ", wait = %d,
> Thread QS cnt = %"
> +PRIu64 ", Thread ID = %d",
>  				__func__, t, wait, c, id+j);
> 
>  			/* Counter is not checked for wrap-around condition
> @@ -643,12 +643,12 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v,
> uint64_t t, bool wait)
> 
>  	for (i = 0, cnt = v->qsbr_cnt; i < v->max_threads; i++, cnt++) {
>  		__RTE_RCU_DP_LOG(DEBUG,
> -			"%s: check: token = %"PRIu64", wait = %d, Thread ID
> = %d",
> +			"%s: check: token = %" PRIu64 ", wait = %d, Thread
> ID = %d",
>  			__func__, t, wait, i);
>  		while (1) {
>  			c = __atomic_load_n(&cnt->cnt,
> __ATOMIC_ACQUIRE);
>  			__RTE_RCU_DP_LOG(DEBUG,
> -				"%s: status: token = %"PRIu64", wait = %d,
> Thread QS cnt = %"PRIu64", Thread ID = %d",
> +				"%s: status: token = %" PRIu64 ", wait = %d,
> Thread QS cnt = %"
> +PRIu64 ", Thread ID = %d",
>  				__func__, t, wait, c, i);
> 
>  			/* Counter is not checked for wrap-around condition
> @@ -725,10 +725,10 @@ rte_rcu_qsbr_check(struct rte_rcu_qsbr *v,
> uint64_t t, bool wait)
>  	/* Check if all the readers have already acknowledged this token */
>  	if (likely(t <= v->acked_token)) {
>  		__RTE_RCU_DP_LOG(DEBUG,
> -			"%s: check: token = %"PRIu64", wait = %d",
> +			"%s: check: token = %" PRIu64 ", wait = %d",
>  			__func__, t, wait);
>  		__RTE_RCU_DP_LOG(DEBUG,
> -			"%s: status: least acked token = %"PRIu64"",
> +			"%s: status: least acked token = %" PRIu64,
>  			__func__, v->acked_token);
>  		return 1;
>  	}
> --
> 2.25.4


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

* [dpdk-stable] [PATCH v2] lib/rcu: avoid literal suffix warning in C++ mode
  2020-08-31 21:38 [dpdk-stable] [PATCH] rcu: avoid literal suffix warning in C++ mode Dmitry Kozlyuk
  2020-09-04  6:27 ` Honnappa Nagarahalli
@ 2020-09-04 20:47 ` Dmitry Kozlyuk
  2020-09-05  1:47   ` Honnappa Nagarahalli
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Kozlyuk @ 2020-09-04 20:47 UTC (permalink / raw)
  To: dev; +Cc: Dmitry Kozlyuk, stable, Honnappa Nagarahalli

Sequences like "value = %"PRIu64 (no space before PRIu64) are parsed as
a single preprocessor token, user-defined-string-literal, in C++11
onwards. While modern compilers are smart enough to parse this properly,
GCC 9.3.0 generates warnings like:

    rte_rcu_qsbr.h:555:26: warning: invalid suffix on literal; C++11
    requires a space between literal and string macro [-Wliteral-suffix]

Add spaces around format specifier macros to make public headers
compatible with C++ without causing warnings. Make similar changes in C
source for style consistency within the library.

Fixes: 64994b56c ("rcu: add RCU library supporting QSBR mechanism")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---

v2: fix subject line, adjust C source for style consistency.

 lib/librte_rcu/rte_rcu_qsbr.c | 13 +++++++------
 lib/librte_rcu/rte_rcu_qsbr.h | 14 +++++++-------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/lib/librte_rcu/rte_rcu_qsbr.c b/lib/librte_rcu/rte_rcu_qsbr.c
index aebfdb0da..a5f9de326 100644
--- a/lib/librte_rcu/rte_rcu_qsbr.c
+++ b/lib/librte_rcu/rte_rcu_qsbr.c
@@ -244,10 +244,10 @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v)
 
 	fprintf(f, "\n");
 
-	fprintf(f, "  Token = %"PRIu64"\n",
+	fprintf(f, "  Token = %" PRIu64 "\n",
 			__atomic_load_n(&v->token, __ATOMIC_ACQUIRE));
 
-	fprintf(f, "  Least Acknowledged Token = %"PRIu64"\n",
+	fprintf(f, "  Least Acknowledged Token = %" PRIu64 "\n",
 			__atomic_load_n(&v->acked_token, __ATOMIC_ACQUIRE));
 
 	fprintf(f, "Quiescent State Counts for readers:\n");
@@ -257,7 +257,7 @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v)
 		id = i << __RTE_QSBR_THRID_INDEX_SHIFT;
 		while (bmap) {
 			t = __builtin_ctzl(bmap);
-			fprintf(f, "thread ID = %u, count = %"PRIu64", lock count = %u\n",
+			fprintf(f, "thread ID = %u, count = %" PRIu64 ", lock count = %u\n",
 				id + t,
 				__atomic_load_n(
 					&v->qsbr_cnt[id + t].cnt,
@@ -402,7 +402,7 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e)
 		 * other issues.
 		 */
 		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
-			"%s(): Skipped enqueuing token = %"PRIu64"\n",
+			"%s(): Skipped enqueuing token = %" PRIu64 "\n",
 			__func__, dq_elem->token);
 
 		rte_errno = ENOSPC;
@@ -410,7 +410,8 @@ int rte_rcu_qsbr_dq_enqueue(struct rte_rcu_qsbr_dq *dq, void *e)
 	}
 
 	rte_log(RTE_LOG_INFO, rte_rcu_log_type,
-		"%s(): Enqueued token = %"PRIu64"\n", __func__, dq_elem->token);
+		"%s(): Enqueued token = %" PRIu64 "\n",
+		__func__, dq_elem->token);
 
 	return 0;
 }
@@ -449,7 +450,7 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n,
 		rte_ring_dequeue_elem_finish(dq->r, 1);
 
 		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
-			"%s(): Reclaimed token = %"PRIu64"\n",
+			"%s(): Reclaimed token = %" PRIu64 "\n",
 			__func__, dq_elem->token);
 
 		dq->free_fn(dq->p, dq_elem->elem, 1);
diff --git a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h
index a98e8f0f8..aa237cf75 100644
--- a/lib/librte_rcu/rte_rcu_qsbr.h
+++ b/lib/librte_rcu/rte_rcu_qsbr.h
@@ -552,7 +552,7 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v, unsigned int thread_id)
 		__atomic_store_n(&v->qsbr_cnt[thread_id].cnt,
 					 t, __ATOMIC_RELEASE);
 
-	__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %"PRIu64", Thread ID = %d",
+	__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %" PRIu64 ", Thread ID = %d",
 		__func__, t, thread_id);
 }
 
@@ -580,13 +580,13 @@ __rte_rcu_qsbr_check_selective(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 		while (bmap) {
 			j = __builtin_ctzl(bmap);
 			__RTE_RCU_DP_LOG(DEBUG,
-				"%s: check: token = %"PRIu64", wait = %d, Bit Map = 0x%"PRIx64", Thread ID = %d",
+				"%s: check: token = %" PRIu64 ", wait = %d, Bit Map = 0x%" PRIx64 ", Thread ID = %d",
 				__func__, t, wait, bmap, id + j);
 			c = __atomic_load_n(
 					&v->qsbr_cnt[id + j].cnt,
 					__ATOMIC_ACQUIRE);
 			__RTE_RCU_DP_LOG(DEBUG,
-				"%s: status: token = %"PRIu64", wait = %d, Thread QS cnt = %"PRIu64", Thread ID = %d",
+				"%s: status: token = %" PRIu64 ", wait = %d, Thread QS cnt = %" PRIu64 ", Thread ID = %d",
 				__func__, t, wait, c, id+j);
 
 			/* Counter is not checked for wrap-around condition
@@ -643,12 +643,12 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 
 	for (i = 0, cnt = v->qsbr_cnt; i < v->max_threads; i++, cnt++) {
 		__RTE_RCU_DP_LOG(DEBUG,
-			"%s: check: token = %"PRIu64", wait = %d, Thread ID = %d",
+			"%s: check: token = %" PRIu64 ", wait = %d, Thread ID = %d",
 			__func__, t, wait, i);
 		while (1) {
 			c = __atomic_load_n(&cnt->cnt, __ATOMIC_ACQUIRE);
 			__RTE_RCU_DP_LOG(DEBUG,
-				"%s: status: token = %"PRIu64", wait = %d, Thread QS cnt = %"PRIu64", Thread ID = %d",
+				"%s: status: token = %" PRIu64 ", wait = %d, Thread QS cnt = %" PRIu64 ", Thread ID = %d",
 				__func__, t, wait, c, i);
 
 			/* Counter is not checked for wrap-around condition
@@ -725,10 +725,10 @@ rte_rcu_qsbr_check(struct rte_rcu_qsbr *v, uint64_t t, bool wait)
 	/* Check if all the readers have already acknowledged this token */
 	if (likely(t <= v->acked_token)) {
 		__RTE_RCU_DP_LOG(DEBUG,
-			"%s: check: token = %"PRIu64", wait = %d",
+			"%s: check: token = %" PRIu64 ", wait = %d",
 			__func__, t, wait);
 		__RTE_RCU_DP_LOG(DEBUG,
-			"%s: status: least acked token = %"PRIu64"",
+			"%s: status: least acked token = %" PRIu64,
 			__func__, v->acked_token);
 		return 1;
 	}
-- 
2.25.4


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

* Re: [dpdk-stable] [PATCH v2] lib/rcu: avoid literal suffix warning in C++ mode
  2020-09-04 20:47 ` [dpdk-stable] [PATCH v2] lib/rcu: " Dmitry Kozlyuk
@ 2020-09-05  1:47   ` Honnappa Nagarahalli
  2020-10-05 22:47     ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Honnappa Nagarahalli @ 2020-09-05  1:47 UTC (permalink / raw)
  To: Dmitry Kozlyuk, dev; +Cc: stable, nd, Honnappa Nagarahalli, nd

<snip>

> 
> Sequences like "value = %"PRIu64 (no space before PRIu64) are parsed as a
> single preprocessor token, user-defined-string-literal, in C++11 onwards.
> While modern compilers are smart enough to parse this properly, GCC 9.3.0
> generates warnings like:
> 
>     rte_rcu_qsbr.h:555:26: warning: invalid suffix on literal; C++11
>     requires a space between literal and string macro [-Wliteral-suffix]
> 
> Add spaces around format specifier macros to make public headers
> compatible with C++ without causing warnings. Make similar changes in C
> source for style consistency within the library.
> 
> Fixes: 64994b56c ("rcu: add RCU library supporting QSBR mechanism")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Looks good, Thank you.
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> ---
> 
> v2: fix subject line, adjust C source for style consistency.
> 
>  lib/librte_rcu/rte_rcu_qsbr.c | 13 +++++++------
> lib/librte_rcu/rte_rcu_qsbr.h | 14 +++++++-------
>  2 files changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/lib/librte_rcu/rte_rcu_qsbr.c b/lib/librte_rcu/rte_rcu_qsbr.c index
> aebfdb0da..a5f9de326 100644
> --- a/lib/librte_rcu/rte_rcu_qsbr.c
> +++ b/lib/librte_rcu/rte_rcu_qsbr.c
> @@ -244,10 +244,10 @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v)
> 
>  	fprintf(f, "\n");
> 
> -	fprintf(f, "  Token = %"PRIu64"\n",
> +	fprintf(f, "  Token = %" PRIu64 "\n",
>  			__atomic_load_n(&v->token, __ATOMIC_ACQUIRE));
> 
> -	fprintf(f, "  Least Acknowledged Token = %"PRIu64"\n",
> +	fprintf(f, "  Least Acknowledged Token = %" PRIu64 "\n",
>  			__atomic_load_n(&v->acked_token,
> __ATOMIC_ACQUIRE));
> 
>  	fprintf(f, "Quiescent State Counts for readers:\n"); @@ -257,7 +257,7
> @@ rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v)
>  		id = i << __RTE_QSBR_THRID_INDEX_SHIFT;
>  		while (bmap) {
>  			t = __builtin_ctzl(bmap);
> -			fprintf(f, "thread ID = %u, count = %"PRIu64", lock
> count = %u\n",
> +			fprintf(f, "thread ID = %u, count = %" PRIu64 ", lock
> count = %u\n",
>  				id + t,
>  				__atomic_load_n(
>  					&v->qsbr_cnt[id + t].cnt,
> @@ -402,7 +402,7 @@ int rte_rcu_qsbr_dq_enqueue(struct
> rte_rcu_qsbr_dq *dq, void *e)
>  		 * other issues.
>  		 */
>  		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
> -			"%s(): Skipped enqueuing token = %"PRIu64"\n",
> +			"%s(): Skipped enqueuing token = %" PRIu64 "\n",
>  			__func__, dq_elem->token);
> 
>  		rte_errno = ENOSPC;
> @@ -410,7 +410,8 @@ int rte_rcu_qsbr_dq_enqueue(struct
> rte_rcu_qsbr_dq *dq, void *e)
>  	}
> 
>  	rte_log(RTE_LOG_INFO, rte_rcu_log_type,
> -		"%s(): Enqueued token = %"PRIu64"\n", __func__, dq_elem-
> >token);
> +		"%s(): Enqueued token = %" PRIu64 "\n",
> +		__func__, dq_elem->token);
> 
>  	return 0;
>  }
> @@ -449,7 +450,7 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq
> *dq, unsigned int n,
>  		rte_ring_dequeue_elem_finish(dq->r, 1);
> 
>  		rte_log(RTE_LOG_INFO, rte_rcu_log_type,
> -			"%s(): Reclaimed token = %"PRIu64"\n",
> +			"%s(): Reclaimed token = %" PRIu64 "\n",
>  			__func__, dq_elem->token);
> 
>  		dq->free_fn(dq->p, dq_elem->elem, 1); diff --git
> a/lib/librte_rcu/rte_rcu_qsbr.h b/lib/librte_rcu/rte_rcu_qsbr.h index
> a98e8f0f8..aa237cf75 100644
> --- a/lib/librte_rcu/rte_rcu_qsbr.h
> +++ b/lib/librte_rcu/rte_rcu_qsbr.h
> @@ -552,7 +552,7 @@ rte_rcu_qsbr_quiescent(struct rte_rcu_qsbr *v,
> unsigned int thread_id)
>  		__atomic_store_n(&v->qsbr_cnt[thread_id].cnt,
>  					 t, __ATOMIC_RELEASE);
> 
> -	__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %"PRIu64",
> Thread ID = %d",
> +	__RTE_RCU_DP_LOG(DEBUG, "%s: update: token = %" PRIu64 ",
> Thread ID =
> +%d",
>  		__func__, t, thread_id);
>  }
> 
> @@ -580,13 +580,13 @@ __rte_rcu_qsbr_check_selective(struct
> rte_rcu_qsbr *v, uint64_t t, bool wait)
>  		while (bmap) {
>  			j = __builtin_ctzl(bmap);
>  			__RTE_RCU_DP_LOG(DEBUG,
> -				"%s: check: token = %"PRIu64", wait = %d, Bit
> Map = 0x%"PRIx64", Thread ID = %d",
> +				"%s: check: token = %" PRIu64 ", wait = %d,
> Bit Map = 0x%" PRIx64
> +", Thread ID = %d",
>  				__func__, t, wait, bmap, id + j);
>  			c = __atomic_load_n(
>  					&v->qsbr_cnt[id + j].cnt,
>  					__ATOMIC_ACQUIRE);
>  			__RTE_RCU_DP_LOG(DEBUG,
> -				"%s: status: token = %"PRIu64", wait = %d,
> Thread QS cnt = %"PRIu64", Thread ID = %d",
> +				"%s: status: token = %" PRIu64 ", wait = %d,
> Thread QS cnt = %"
> +PRIu64 ", Thread ID = %d",
>  				__func__, t, wait, c, id+j);
> 
>  			/* Counter is not checked for wrap-around condition
> @@ -643,12 +643,12 @@ __rte_rcu_qsbr_check_all(struct rte_rcu_qsbr *v,
> uint64_t t, bool wait)
> 
>  	for (i = 0, cnt = v->qsbr_cnt; i < v->max_threads; i++, cnt++) {
>  		__RTE_RCU_DP_LOG(DEBUG,
> -			"%s: check: token = %"PRIu64", wait = %d, Thread ID
> = %d",
> +			"%s: check: token = %" PRIu64 ", wait = %d, Thread
> ID = %d",
>  			__func__, t, wait, i);
>  		while (1) {
>  			c = __atomic_load_n(&cnt->cnt,
> __ATOMIC_ACQUIRE);
>  			__RTE_RCU_DP_LOG(DEBUG,
> -				"%s: status: token = %"PRIu64", wait = %d,
> Thread QS cnt = %"PRIu64", Thread ID = %d",
> +				"%s: status: token = %" PRIu64 ", wait = %d,
> Thread QS cnt = %"
> +PRIu64 ", Thread ID = %d",
>  				__func__, t, wait, c, i);
> 
>  			/* Counter is not checked for wrap-around condition
> @@ -725,10 +725,10 @@ rte_rcu_qsbr_check(struct rte_rcu_qsbr *v,
> uint64_t t, bool wait)
>  	/* Check if all the readers have already acknowledged this token */
>  	if (likely(t <= v->acked_token)) {
>  		__RTE_RCU_DP_LOG(DEBUG,
> -			"%s: check: token = %"PRIu64", wait = %d",
> +			"%s: check: token = %" PRIu64 ", wait = %d",
>  			__func__, t, wait);
>  		__RTE_RCU_DP_LOG(DEBUG,
> -			"%s: status: least acked token = %"PRIu64"",
> +			"%s: status: least acked token = %" PRIu64,
>  			__func__, v->acked_token);
>  		return 1;
>  	}
> --
> 2.25.4


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

* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] lib/rcu: avoid literal suffix warning in C++ mode
  2020-09-05  1:47   ` Honnappa Nagarahalli
@ 2020-10-05 22:47     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2020-10-05 22:47 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: dev, stable, nd, Honnappa Nagarahalli

> > Sequences like "value = %"PRIu64 (no space before PRIu64) are parsed as a
> > single preprocessor token, user-defined-string-literal, in C++11 onwards.
> > While modern compilers are smart enough to parse this properly, GCC 9.3.0
> > generates warnings like:
> > 
> >     rte_rcu_qsbr.h:555:26: warning: invalid suffix on literal; C++11
> >     requires a space between literal and string macro [-Wliteral-suffix]
> > 
> > Add spaces around format specifier macros to make public headers
> > compatible with C++ without causing warnings. Make similar changes in C
> > source for style consistency within the library.
> > 
> > Fixes: 64994b56c ("rcu: add RCU library supporting QSBR mechanism")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Looks good, Thank you.
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Applied, thanks




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

end of thread, other threads:[~2020-10-05 22:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 21:38 [dpdk-stable] [PATCH] rcu: avoid literal suffix warning in C++ mode Dmitry Kozlyuk
2020-09-04  6:27 ` Honnappa Nagarahalli
2020-09-04 20:47 ` [dpdk-stable] [PATCH v2] lib/rcu: " Dmitry Kozlyuk
2020-09-05  1:47   ` Honnappa Nagarahalli
2020-10-05 22:47     ` [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).