From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Green Subject: [PATCH v3 25/40] rte_dev.h: stack declaration at top of own basic block Date: Thu, 10 May 2018 10:48:24 +0800 Message-ID: <152592050495.119328.12850118122298660952.stgit@localhost.localdomain> References: <152591991920.119328.14523975619615362920.stgit@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: dev@dpdk.org Return-path: Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id D7A2B1B864 for ; Thu, 10 May 2018 04:48:28 +0200 (CEST) In-Reply-To: <152591991920.119328.14523975619615362920.stgit@localhost.localdomain> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" /projects/lagopus/src/dpdk/build/include/rte_dev.h:54:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] char buffer[vsnprintf(NULL, 0, fmt, ap) + 1]; Signed-off-by: Andy Green --- 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 0955e9adb..3879ff3ca 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); + } } /*