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

Jani Nikula jani at nikula.org
Sat Jan 7 15:26:19 PST 2012


notmuch-restore.c: In function ‘notmuch_restore_command’:
notmuch-restore.c:87:54: warning: ISO C99 requires rest arguments to be used [enabled by default]

and elsewhere. ##__VA_ARGS__ is a GCC CPP extension.

Signed-off-by: Jani Nikula <jani at nikula.org>
---
 notmuch-client.h |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 517c010..3f4751a 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -93,14 +93,17 @@ typedef struct notmuch_show_params {
  *
  * Note that __location__ comes from talloc.h.
  */
-#define INTERNAL_ERROR(format, ...)			\
+
+#define _INTERNAL_ERROR(format, ...)			\
     do {						\
 	fprintf(stderr,					\
-		"Internal error: " format " (%s)\n",	\
-		##__VA_ARGS__, __location__);		\
+		"Internal error: " format "%s (%s)\n",	\
+		__VA_ARGS__, __location__);		\
 	exit (1);					\
     } while (0)
 
+#define INTERNAL_ERROR(...) _INTERNAL_ERROR(__VA_ARGS__, "")
+
 #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
 
 #define STRNCMP_LITERAL(var, literal) \
-- 
1.7.5.4



More information about the notmuch mailing list