Use __VA_ARGS__ for all of error's arguments
QNX 6.3.2 uses GCC 2.95.3 by default, and GCC 2.95.3 doesn't remove the comma if the error macro's variable argument is left out. Instead of testing for a sufficiently recent version of GCC, make __VA_ARGS__ match all of the arguments. Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matt Kraai committed
Feb 8, 2013 at 07:09 UTC
9798f7e5f948b2586c33d850f6a00d4fc0537d75
1 file changed
+5
-5
git-compat-util.h
+5
-5
@@ -290,13 +290,13 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)))
290
291
/*
292
* Let callers be aware of the constant return value; this can help
293
- * gcc with -Wuninitialized analysis. We have to restrict this trick to
294
- * gcc, though, because of the variadic macro and the magic ## comma pasting
295
- * behavior. But since we're only trying to help gcc, anyway, it's OK; other
296
- * compilers will fall back to using the function as usual.
293
+ * gcc with -Wuninitialized analysis. We restrict this trick to gcc, though,
294
+ * because some compilers may not support variadic macros. Since we're only
295
+ * trying to help gcc, anyway, it's OK; other compilers will fall back to
296
+ * using the function as usual.
297
*/
298
#ifdef __GNUC__
299
-#define error(fmt, ...) (error((fmt), ##__VA_ARGS__), -1)
299
+#define error(...) (error(__VA_ARGS__), -1)
300
#endif
301
302
extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));