From e3908132b7903dbbf45c6d073792cccc890812e0 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 12 May 2018 09:59:32 +0800 Subject: [PATCH] eal: declare trace buffer at top of own block rte_dev.h:54:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] char buffer[vsnprintf(NULL, 0, fmt, ap) + 1]; Fixes: b974e4a40cb5 ("ethdev: make error checking macros public") Cc: stable@dpdk.org Signed-off-by: Andy Green Reviewed-by: Stephen Hemminger --- lib/librte_eal/common/include/rte_dev.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 0955e9adb4..3879ff3cac 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -51,15 +51,18 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...) va_start(ap, fmt); - char buffer[vsnprintf(NULL, 0, fmt, ap) + 1]; + { + char buffer[vsnprintf(NULL, 0, fmt, ap) + 1]; - va_end(ap); + va_end(ap); - va_start(ap, fmt); - vsnprintf(buffer, sizeof(buffer), fmt, ap); - va_end(ap); + va_start(ap, fmt); + vsnprintf(buffer, sizeof(buffer), fmt, ap); + va_end(ap); - rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer); + rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", + func_name, buffer); + } } /* -- 2.20.1