From: Junio C Hamano Date: Fri, 19 Apr 2013 20:45:04 +0000 (-0700) Subject: Merge branch 'jk/a-thread-only-dies-once' X-Git-Tag: v1.8.3-rc0~41 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9526aa461f6c6900cb892a6fe248150ad436c0d5 Merge branch 'jk/a-thread-only-dies-once' A regression fix for the logic to detect die() handler triggering itself recursively. * jk/a-thread-only-dies-once: run-command: use thread-aware die_is_recursing routine usage: allow pluggable die-recursion checks --- 9526aa461f6c6900cb892a6fe248150ad436c0d5 diff --cc git-compat-util.h index cde442fb5f,6aee9df868..e955bb5e8b --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -318,19 -299,9 +318,20 @@@ extern NORETURN void die_errno(const ch extern int error(const char *err, ...) __attribute__((format (printf, 1, 2))); 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 restrict this trick to gcc, though, + * because some compilers may not support variadic macros. Since we're only + * trying to help gcc, anyway, it's OK; other compilers will fall back to + * using the function as usual. + */ +#if defined(__GNUC__) && ! defined(__clang__) +#define error(...) (error(__VA_ARGS__), -1) +#endif + 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)); + extern void set_die_is_recursing_routine(int (*routine)(void)); extern int prefixcmp(const char *str, const char *prefix); extern int suffixcmp(const char *str, const char *suffix);