From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E4B7E3787 for ; Tue, 10 Nov 2015 17:55:58 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 10 Nov 2015 08:55:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,271,1444719600"; d="scan'208";a="847684149" Received: from dwdohert-dpdk-fedora-20.ir.intel.com ([163.33.213.96]) by fmsmga002.fm.intel.com with ESMTP; 10 Nov 2015 08:55:50 -0800 To: dev@dpdk.org, Bruce Richardson References: <1446572746-26207-1-git-send-email-declan.doherty@intel.com> <1447101259-18972-1-git-send-email-declan.doherty@intel.com> <1447101259-18972-3-git-send-email-declan.doherty@intel.com> <20151110155053.GU4013@6wind.com> From: Declan Doherty Message-ID: <564222C3.6000405@intel.com> Date: Tue, 10 Nov 2015 17:00:51 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20151110155053.GU4013@6wind.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 02/10] ethdev: make error checking macros public X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Nov 2015 16:55:59 -0000 On 10/11/15 15:50, Adrien Mazarguil wrote: > On Mon, Nov 09, 2015 at 08:34:11PM +0000, Declan Doherty wrote: >> Move the function pointer and port id checking macros to rte_ethdev and >> rte_dev header files, so that they can be used in the static inline >> functions there. Also replace the RTE_LOG call within >> RTE_PMD_DEBUG_TRACE so this macro can be built with the -pedantic flag >> >> Signed-off-by: Declan Doherty >> --- >> lib/librte_eal/common/include/rte_dev.h | 52 +++++++++++++++++++++++++++++++ >> lib/librte_ether/rte_ethdev.c | 54 --------------------------------- >> lib/librte_ether/rte_ethdev.h | 26 ++++++++++++++++ >> 3 files changed, 78 insertions(+), 54 deletions(-) >> >> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h >> index f601d21..fd09b3d 100644 >> --- a/lib/librte_eal/common/include/rte_dev.h >> +++ b/lib/librte_eal/common/include/rte_dev.h >> @@ -46,8 +46,60 @@ >> extern "C" { >> #endif >> >> +#include >> #include >> >> +#include >> + >> +__attribute__((format(printf, 2, 0))) >> +static inline void >> +rte_pmd_debug_trace(const char *func_name, const char *fmt, ...) >> +{ >> + va_list ap; >> + >> + va_start(ap, fmt); > > I suggest adding an empty line here since we're mixing code and > declarations. > sure no problem. >> + char buffer[vsnprintf(NULL, 0, fmt, ap)]; > > I forgot an extra byte for trailing '\0' in my original comment, the above > line should read: > > char buffer[vsnprintf(NULL, 0, fmt, ap) + 1]; > > Otherwise the last character will be missing. Did you test that function? > I didn't notice the truncation in the log message, I was just missing and "!" in the log message and didn't miss it. I'll push a new version with this fix. >> + >> + 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); >> +} >> + >> -- >> 2.4.3 >> >