Skip to content

Commit 9798f7e

Browse files
Matt Kraaigitster
authored andcommitted
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 <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a469a10 commit 9798f7e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

git-compat-util.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,13 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)))
290290

291291
/*
292292
* 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.
297297
*/
298298
#ifdef __GNUC__
299-
#define error(fmt, ...) (error((fmt), ##__VA_ARGS__), -1)
299+
#define error(...) (error(__VA_ARGS__), -1)
300300
#endif
301301

302302
extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));

0 commit comments

Comments
 (0)