From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id D32761B934 for ; Fri, 14 Dec 2018 22:23:41 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Dec 2018 13:23:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,354,1539673200"; d="scan'208";a="130054782" Received: from ae13-28.jf.intel.com ([10.166.188.62]) by fmsmga001.fm.intel.com with ESMTP; 14 Dec 2018 13:23:39 -0800 Date: Fri, 14 Dec 2018 13:20:07 -0800 From: Jeff Shaw To: Stephen Hemminger Cc: Mattias =?iso-8859-1?Q?R=F6nnblom?= , Jeff Shaw , dev@dpdk.org Message-ID: <20181214212007.GA6612@ae13-28.jf.intel.com> References: <20181214163827.9403-1-jeffrey.b.shaw@intel.com> <20181214190713.GB9964@ae13-28.jf.intel.com> <3a573b56-6ea0-812c-4641-830fbd3c59cc@ericsson.com> <20181214125055.1153c38c@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181214125055.1153c38c@xeon-e3> User-Agent: Mutt/1.9.2 (2017-12-15) Subject: Re: [dpdk-dev] [PATCH] eal: simplify RTE_PMD_DEBUG_TRACE X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2018 21:23:42 -0000 On Fri, Dec 14, 2018 at 12:50:55PM -0800, Stephen Hemminger wrote: > Use rte_log directly, eliminating no longer used rte_pmd_dev_trace > function. This removes variable length array which is problem on > Windows and other compilers not doing C99. > > Also, drop unused RTE_PROC_PRIMARY macros. > > Reported-by: Jeff Shaw > Signed-off-by: Stephen Hemminger > --- > lib/librte_eal/common/include/rte_dev.h | 43 ++----------------------- > 1 file changed, 3 insertions(+), 40 deletions(-) > > diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h > index a9724dc9181c..e496da440028 100644 > --- a/lib/librte_eal/common/include/rte_dev.h > +++ b/lib/librte_eal/common/include/rte_dev.h > @@ -43,54 +43,17 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name, > enum rte_dev_event_type event, > void *cb_arg); > > -__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); > - > - { > - char buffer[vsnprintf(NULL, 0, fmt, ap) + 1]; > - > - 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); > - } > -} > - Will this break applications that try to use this function? Because it is not a documented function, is there no guarantee it will be present? > /* > * Enable RTE_PMD_DEBUG_TRACE() when at least one component relying on the > * RTE_*_RET() macros defined below is compiled in debug mode. > */ > #if defined(RTE_LIBRTE_EVENTDEV_DEBUG) > -#define RTE_PMD_DEBUG_TRACE(...) \ > - rte_pmd_debug_trace(__func__, __VA_ARGS__) > +#define RTE_PMD_DEBUG_TRACE(fmt, args...) \ > + rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s():" fmt, __func__, ## args) Actually, MSVC does not support named variable arguments either. I think this will work instead: #define RTE_PMD_DEBUG_TRACE(fmt, ...) \ rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s():" fmt, __func__, __VA_ARGS__) The previous behavior was "%s: ..." not "%s():". I'm not sure if you meant to change how the messages are displayed. I don't care either way, but maybe users of the function would prefer the same format.