From: Adrien Mazarguil <adrien.mazarg...@6wind.com>

The original definitions prevent external programs/libraries from compiling
without warnings when using these headers and -std=gnu99 (relaxed C99 mode).

Acked-by: Ivan Boule <ivan.boule at 6wind.com>
Acked-by: Damien Millescamps <damien.millescamps at 6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
---
 lib/librte_cmdline/cmdline_cirbuf.h       |    5 +++--
 lib/librte_eal/common/include/rte_debug.h |    3 ++-
 lib/librte_eal/common/include/rte_log.h   |   15 +++++++--------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/lib/librte_cmdline/cmdline_cirbuf.h 
b/lib/librte_cmdline/cmdline_cirbuf.h
index f934292..36b04ec 100644
--- a/lib/librte_cmdline/cmdline_cirbuf.h
+++ b/lib/librte_cmdline/cmdline_cirbuf.h
@@ -81,9 +81,10 @@ struct cirbuf {
 /* #define CIRBUF_DEBUG */

 #ifdef CIRBUF_DEBUG
-#define dprintf(fmt, ...) printf("line %3.3d - " fmt, __LINE__, ##__VA_ARGS__)
+#define dprintf_(fmt, ...) printf("line %3.3d - " fmt "%.0s", __LINE__, 
__VA_ARGS__)
+#define dprintf(...) dprintf_(__VA_ARGS__, "dummy")
 #else
-#define dprintf(args...) do {} while(0)
+#define dprintf(...) (void)0
 #endif


diff --git a/lib/librte_eal/common/include/rte_debug.h 
b/lib/librte_eal/common/include/rte_debug.h
index 451220e..1936dde 100644
--- a/lib/librte_eal/common/include/rte_debug.h
+++ b/lib/librte_eal/common/include/rte_debug.h
@@ -77,7 +77,8 @@ void rte_dump_registers(void);
  * @param args
  *   The variable list of arguments.
  */
-#define rte_panic(format, args...) __rte_panic(__func__, format, ## args)
+#define rte_panic_(func, format, ...) __rte_panic(func, format "%.0s", 
__VA_ARGS__)
+#define rte_panic(...) rte_panic_(__func__, __VA_ARGS__, "dummy")

 /*
  * Provide notification of a critical non-recoverable error and stop.
diff --git a/lib/librte_eal/common/include/rte_log.h 
b/lib/librte_eal/common/include/rte_log.h
index d361130..9a17730 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -274,14 +274,13 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char 
*format, va_list ap);
  *   - 0: Success.
  *   - Negative on error.
  */
-#define RTE_LOG(l, t, fmt, args...) ({                                 \
-       if ((RTE_LOG_##l <= RTE_LOG_LEVEL) &&                           \
-           (RTE_LOG_##l <= rte_logs.level) &&                          \
-           (RTE_LOGTYPE_##t & rte_logs.type)) {                        \
-               rte_log(RTE_LOG_##l, RTE_LOGTYPE_##t,                   \
-                         #t ": " fmt, ## args);                        \
-       }                                                               \
-})
+#define RTE_LOG(l, t, ...)                                     \
+       (((RTE_LOG_ ## l <= RTE_LOG_LEVEL) &&                   \
+         (RTE_LOG_ ## l <= rte_logs.level) &&                  \
+         (RTE_LOGTYPE_ ## t & rte_logs.type)) ?                \
+        rte_log(RTE_LOG_ ## l,                                 \
+                RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :     \
+        0)

 #ifdef __cplusplus
 }
-- 
1.7.2.5


Reply via email to