On 12/21/2018 6:18 PM, Jeff Shaw wrote: > From: Stephen Hemminger <step...@networkplumber.org> > > 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. > > Signed-off-by: Stephen Hemminger <step...@networkplumber.org> > Signed-off-by: Jeff Shaw <jeffrey.b.s...@intel.com> > --- > > V3: > - Fix checkpatch error: > ERROR:SPACING: space required before the open parenthesis '(' > > V2: > - Changed named variable "args..." to use "..." with ##__VA_LIST__. > Pasting is necessary to support case where only the format string, > with no arguments, is passed. > > --- > lib/librte_eal/common/include/rte_dev.h | 44 > +++------------------------------ > 1 file changed, 4 insertions(+), 40 deletions(-) > > diff --git a/lib/librte_eal/common/include/rte_dev.h > b/lib/librte_eal/common/include/rte_dev.h > index a9724dc91..d7b3c1576 100644 > --- a/lib/librte_eal/common/include/rte_dev.h > +++ b/lib/librte_eal/common/include/rte_dev.h > @@ -43,54 +43,18 @@ 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); > - } > -} > - > /* > * 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, ...) > \ > + rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: " fmt, __func__, \ > + ##__VA_ARGS__)
When RTE_PMD_DEBUG_TRACE enabled, mlx4/5 drivers are causing build error because of '-pedantic' argument [1]. error is in 'RTE_FUNC_PTR_OR_ERR_RET' & 'RTE_FUNC_PTR_OR_RET', what do you think removing 'RTE_PMD_DEBUG_TRACE' completely from these macros? Since 'RTE_PMD_DEBUG_TRACE' already enabled only with 'RTE_LIBRTE_EVENTDEV_DEBUG' it is already disabled mostly. Another option can be replacing 'RTE_PMD_DEBUG_TRACE' with 'rte_log', but with DEBUG log type to not introduce new logs [2]. [1] error: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Werror,-Wgnu-zero-variadic-macro-arguments] [2] - RTE_PMD_DEBUG_TRACE("Function not supported\n"); \ + rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: Function not supported\n", __func__); \