DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal/windows: vfprintf build warning with clang
@ 2020-11-27 12:07 Nick Connolly
  2020-11-28 21:11 ` Dmitry Kozlyuk
  2020-11-29 13:00 ` [dpdk-dev] [PATCH v2] " Nick Connolly
  0 siblings, 2 replies; 7+ messages in thread
From: Nick Connolly @ 2020-11-27 12:07 UTC (permalink / raw)
  To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
  Cc: dev, David Marchand, Nick Connolly, stable

When building with clang (11.0,--buildtype=debug), eal_lcore.c
produces a -Wformat-nonliteral warning from the vfprintf call
in log_early.

Disable the warning for log_early when building with clang.
MinGW does not seem to detect the warning.

Fixes: b8a36b086625 ("eal/windows: improve CPU and NUMA node detection")
Cc: stable@dpdk.org

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
---
 lib/librte_eal/windows/eal_lcore.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/librte_eal/windows/eal_lcore.c b/lib/librte_eal/windows/eal_lcore.c
index d5ff721e0..d996b4f89 100644
--- a/lib/librte_eal/windows/eal_lcore.c
+++ b/lib/librte_eal/windows/eal_lcore.c
@@ -36,6 +36,11 @@ struct cpu_map {
 
 static struct cpu_map cpu_map = { 0 };
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wformat-nonliteral"
+#endif
+
 /* eal_create_cpu_map() is called before logging is initialized */
 static void
 log_early(const char *format, ...)
@@ -47,6 +52,10 @@ log_early(const char *format, ...)
 	va_end(va);
 }
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 int
 eal_create_cpu_map(void)
 {
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH] eal/windows: vfprintf build warning with clang
  2020-11-27 12:07 [dpdk-dev] [PATCH] eal/windows: vfprintf build warning with clang Nick Connolly
@ 2020-11-28 21:11 ` Dmitry Kozlyuk
  2020-11-28 22:46   ` Nick Connolly
  2020-11-29 13:00 ` [dpdk-dev] [PATCH v2] " Nick Connolly
  1 sibling, 1 reply; 7+ messages in thread
From: Dmitry Kozlyuk @ 2020-11-28 21:11 UTC (permalink / raw)
  To: Nick Connolly
  Cc: Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev,
	David Marchand, stable

On Fri, 27 Nov 2020 12:07:11 +0000, Nick Connolly wrote:
> [...]
> +#ifdef __clang__
> +#pragma clang diagnostic push
> +#pragma clang diagnostic ignored "-Wformat-nonliteral"
> +#endif
> [...]

How about a more safe approach?

diff --git a/lib/librte_eal/windows/eal_lcore.c b/lib/librte_eal/windows/eal_lcore.c
index d5ff721e0..ebcd3474e 100644
--- a/lib/librte_eal/windows/eal_lcore.c
+++ b/lib/librte_eal/windows/eal_lcore.c
@@ -37,6 +37,7 @@ struct cpu_map {
 static struct cpu_map cpu_map = { 0 };
 
 /* eal_create_cpu_map() is called before logging is initialized */
+__rte_format_printf(1, 2)
 static void
 log_early(const char *format, ...)
 {

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

* Re: [dpdk-dev] [PATCH] eal/windows: vfprintf build warning with clang
  2020-11-28 21:11 ` Dmitry Kozlyuk
@ 2020-11-28 22:46   ` Nick Connolly
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Connolly @ 2020-11-28 22:46 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev,
	David Marchand, stable

Looks good to me!

On 28/11/2020 21:11, Dmitry Kozlyuk wrote:
> On Fri, 27 Nov 2020 12:07:11 +0000, Nick Connolly wrote:
>> [...]
>> +#ifdef __clang__
>> +#pragma clang diagnostic push
>> +#pragma clang diagnostic ignored "-Wformat-nonliteral"
>> +#endif
>> [...]
> How about a more safe approach?
>
> diff --git a/lib/librte_eal/windows/eal_lcore.c b/lib/librte_eal/windows/eal_lcore.c
> index d5ff721e0..ebcd3474e 100644
> --- a/lib/librte_eal/windows/eal_lcore.c
> +++ b/lib/librte_eal/windows/eal_lcore.c
> @@ -37,6 +37,7 @@ struct cpu_map {
>   static struct cpu_map cpu_map = { 0 };
>   
>   /* eal_create_cpu_map() is called before logging is initialized */
> +__rte_format_printf(1, 2)
>   static void
>   log_early(const char *format, ...)
>   {


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

* [dpdk-dev] [PATCH v2] eal/windows: vfprintf build warning with clang
  2020-11-27 12:07 [dpdk-dev] [PATCH] eal/windows: vfprintf build warning with clang Nick Connolly
  2020-11-28 21:11 ` Dmitry Kozlyuk
@ 2020-11-29 13:00 ` Nick Connolly
  2020-11-29 13:42   ` Dmitry Kozlyuk
  2020-12-05  0:41   ` Kadam, Pallavi
  1 sibling, 2 replies; 7+ messages in thread
From: Nick Connolly @ 2020-11-29 13:00 UTC (permalink / raw)
  To: Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam
  Cc: dev, David Marchand, Nick Connolly, stable

When building with clang (11.0,--buildtype=debug), eal_lcore.c
produces a -Wformat-nonliteral warning from the vfprintf call
in log_early.

Add __rte_format_printf annotation.

Fixes: b8a36b086625 ("eal/windows: improve CPU and NUMA node detection")
Cc: stable@dpdk.org

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
v2:
* Use __rte_format_printf instead of disabling the warning

 lib/librte_eal/windows/eal_lcore.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_eal/windows/eal_lcore.c b/lib/librte_eal/windows/eal_lcore.c
index d5ff721e0..a85149be9 100644
--- a/lib/librte_eal/windows/eal_lcore.c
+++ b/lib/librte_eal/windows/eal_lcore.c
@@ -38,6 +38,7 @@ static struct cpu_map cpu_map = { 0 };
 
 /* eal_create_cpu_map() is called before logging is initialized */
 static void
+__rte_format_printf(1, 2)
 log_early(const char *format, ...)
 {
 	va_list va;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v2] eal/windows: vfprintf build warning with clang
  2020-11-29 13:00 ` [dpdk-dev] [PATCH v2] " Nick Connolly
@ 2020-11-29 13:42   ` Dmitry Kozlyuk
  2020-12-07 20:25     ` Thomas Monjalon
  2020-12-05  0:41   ` Kadam, Pallavi
  1 sibling, 1 reply; 7+ messages in thread
From: Dmitry Kozlyuk @ 2020-11-29 13:42 UTC (permalink / raw)
  To: Nick Connolly
  Cc: Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev,
	David Marchand, stable

On Sun, 29 Nov 2020 13:00:47 +0000, Nick Connolly wrote:
> When building with clang (11.0,--buildtype=debug), eal_lcore.c
> produces a -Wformat-nonliteral warning from the vfprintf call
> in log_early.
> 
> Add __rte_format_printf annotation.
> 
> Fixes: b8a36b086625 ("eal/windows: improve CPU and NUMA node detection")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
> Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---
> v2:
> * Use __rte_format_printf instead of disabling the warning
> 
>  lib/librte_eal/windows/eal_lcore.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_eal/windows/eal_lcore.c b/lib/librte_eal/windows/eal_lcore.c
> index d5ff721e0..a85149be9 100644
> --- a/lib/librte_eal/windows/eal_lcore.c
> +++ b/lib/librte_eal/windows/eal_lcore.c
> @@ -38,6 +38,7 @@ static struct cpu_map cpu_map = { 0 };
>  
>  /* eal_create_cpu_map() is called before logging is initialized */
>  static void
> +__rte_format_printf(1, 2)
>  log_early(const char *format, ...)
>  {
>  	va_list va;

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

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

* Re: [dpdk-dev] [PATCH v2] eal/windows: vfprintf build warning with clang
  2020-11-29 13:00 ` [dpdk-dev] [PATCH v2] " Nick Connolly
  2020-11-29 13:42   ` Dmitry Kozlyuk
@ 2020-12-05  0:41   ` Kadam, Pallavi
  1 sibling, 0 replies; 7+ messages in thread
From: Kadam, Pallavi @ 2020-12-05  0:41 UTC (permalink / raw)
  To: Nick Connolly, Dmitry Kozlyuk, Narcisa Ana Maria Vasile, Dmitry Malloy
  Cc: dev, David Marchand, stable


On 11/29/2020 5:00 AM, Nick Connolly wrote:
> When building with clang (11.0,--buildtype=debug), eal_lcore.c
> produces a -Wformat-nonliteral warning from the vfprintf call
> in log_early.
>
> Add __rte_format_printf annotation.
>
> Fixes: b8a36b086625 ("eal/windows: improve CPU and NUMA node detection")
> Cc: stable@dpdk.org
>
> Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
> Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---
Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>

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

* Re: [dpdk-dev] [PATCH v2] eal/windows: vfprintf build warning with clang
  2020-11-29 13:42   ` Dmitry Kozlyuk
@ 2020-12-07 20:25     ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2020-12-07 20:25 UTC (permalink / raw)
  To: Nick Connolly
  Cc: dev, Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam, dev,
	David Marchand, stable, Dmitry Kozlyuk

29/11/2020 14:42, Dmitry Kozlyuk:
> On Sun, 29 Nov 2020 13:00:47 +0000, Nick Connolly wrote:
> > When building with clang (11.0,--buildtype=debug), eal_lcore.c
> > produces a -Wformat-nonliteral warning from the vfprintf call
> > in log_early.
> > 
> > Add __rte_format_printf annotation.
> > 
> > Fixes: b8a36b086625 ("eal/windows: improve CPU and NUMA node detection")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
> > Suggested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> 
> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

Applied, thanks



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

end of thread, other threads:[~2020-12-07 20:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 12:07 [dpdk-dev] [PATCH] eal/windows: vfprintf build warning with clang Nick Connolly
2020-11-28 21:11 ` Dmitry Kozlyuk
2020-11-28 22:46   ` Nick Connolly
2020-11-29 13:00 ` [dpdk-dev] [PATCH v2] " Nick Connolly
2020-11-29 13:42   ` Dmitry Kozlyuk
2020-12-07 20:25     ` Thomas Monjalon
2020-12-05  0:41   ` Kadam, Pallavi

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