git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use __VA_ARGS__ for all of error's arguments
@ 2013-02-07 20:00 Matt Kraai
  2013-02-07 21:05 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Kraai @ 2013-02-07 20:00 UTC (permalink / raw)
  To: git, Max Horn, Jeff King, Junio C Hamano; +Cc: Matt Kraai

From: Matt Kraai <matt.kraai@amo.abbott.com>

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.  Since this should work on any
C99-compliant compiler, also remove the tests around the macro definition.

Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
---
 git-compat-util.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/git-compat-util.h b/git-compat-util.h
index cc2abee..df1681f 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -305,14 +305,9 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)))
 
 /*
  * Let callers be aware of the constant return value; this can help
- * gcc with -Wuninitialized analysis. We have to restrict this trick to
- * gcc, though, because of the variadic macro and the magic ## comma pasting
- * behavior. But since we're only trying to help gcc, anyway, it's OK; other
- * compilers will fall back to using the function as usual.
+ * gcc with -Wuninitialized analysis.
  */
-#if defined(__GNUC__) && ! defined(__clang__)
-#define error(fmt, ...) (error((fmt), ##__VA_ARGS__), -1)
-#endif
+#define error(...) (error(__VA_ARGS__), -1)
 
 extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));
 extern void set_error_routine(void (*routine)(const char *err, va_list params));
-- 
1.8.1.GIT

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-02-08 15:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-07 20:00 [PATCH] Use __VA_ARGS__ for all of error's arguments Matt Kraai
2013-02-07 21:05 ` Junio C Hamano
2013-02-07 21:14   ` John Keeping
2013-02-07 21:24   ` Matt Kraai
2013-02-07 21:30     ` Matt Kraai
2013-02-08  4:24       ` Jeff King
2013-02-08  4:39         ` Matt Kraai
2013-02-08 15:09           ` Matt Kraai
2013-02-08 15:54             ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).