[RFC PATCH 6/9] cli: fix another warning about variadic macros

Subject: [RFC PATCH 6/9] cli: fix another warning about variadic macros

Date: Sun, 8 Jan 2012 01:26:20 +0200

To: notmuch@notmuchmail.org

Cc:

From: Jani Nikula


notmuch-setup.c: In function ‘notmuch_setup_command’:
notmuch-setup.c:144:62: warning: ISO C99 requires rest arguments to be used [enabled by default]
notmuch-setup.c:174:18: warning: ISO C99 requires rest arguments to be used [enabled by default]

Signed-off-by: Jani Nikula <jani@nikula.org>
---
 notmuch-setup.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/notmuch-setup.c b/notmuch-setup.c
index c3ea937..7b25680 100644
--- a/notmuch-setup.c
+++ b/notmuch-setup.c
@@ -102,9 +102,9 @@ notmuch_setup_command (unused (void *ctx),
     const char **new_tags;
     size_t new_tags_len;
 
-#define prompt(format, ...)					\
+#define __prompt(format, ...)					\
     do {							\
-	printf (format, ##__VA_ARGS__);				\
+	printf (format, __VA_ARGS__);				\
 	fflush (stdout);					\
 	if (getline (&response, &response_size, stdin) < 0) {	\
 	    printf ("Exiting.\n");				\
@@ -113,6 +113,9 @@ notmuch_setup_command (unused (void *ctx),
 	chomp_newline (response);				\
     } while (0)
 
+#define _prompt(format, ...) __prompt(format "%s", __VA_ARGS__)
+#define prompt(...) _prompt(__VA_ARGS__, "")
+
     config = notmuch_config_open (ctx, NULL, &is_new);
 
     if (is_new)
-- 
1.7.5.4


Thread: