[v2] eal/windows: vfprintf build warning with clang

Message ID 20201129130047.798-1-nick.connolly@mayadata.io (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] eal/windows: vfprintf build warning with clang |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Nick Connolly Nov. 29, 2020, 1 p.m. UTC
  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(+)
  

Comments

Dmitry Kozlyuk Nov. 29, 2020, 1:42 p.m. UTC | #1
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>
  
Kadam, Pallavi Dec. 5, 2020, 12:41 a.m. UTC | #2
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>
  
Thomas Monjalon Dec. 7, 2020, 8:25 p.m. UTC | #3
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
  

Patch

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;