[04/15] cmdline: use GCC and MSVC common VA ARGS extension
Checks
Commit Message
Use ... and forward with __VA_ARGS__ instead of args... and args.
Neither mechanism is conformant with the standard but the former works
with both GCC and MSVC.
Fix checkpatches warning about style while(0) -> while (0)
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
lib/cmdline/cmdline_parse.c | 2 +-
lib/cmdline/cmdline_parse_num.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
On Mon, Feb 12, 2024 at 01:49:06PM -0800, Tyler Retzlaff wrote:
> Use ... and forward with __VA_ARGS__ instead of args... and args.
> Neither mechanism is conformant with the standard but the former works
> with both GCC and MSVC.
>
> Fix checkpatches warning about style while(0) -> while (0)
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
@@ -16,7 +16,7 @@
#ifdef RTE_LIBRTE_CMDLINE_DEBUG
#define debug_printf printf
#else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
#endif
#define CMDLINE_BUFFER_SIZE 64
@@ -14,9 +14,9 @@
#include "cmdline_parse_num.h"
#ifdef RTE_LIBRTE_CMDLINE_DEBUG
-#define debug_printf(args...) printf(args)
+#define debug_printf(...) printf(__VA_ARGS__)
#else
-#define debug_printf(args...) do {} while(0)
+#define debug_printf(...) do {} while (0)
#endif
struct cmdline_token_ops cmdline_token_num_ops = {