From: Andy Green Date: Sat, 12 May 2018 01:59:32 +0000 (+0800) Subject: eal: declare trace buffer at top of own block X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e3908132b7903dbbf45c6d073792cccc890812e0;p=dpdk.git 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 --- 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); + } } /*