From: Junio C Hamano Date: Fri, 26 Apr 2013 18:25:59 +0000 (-0700) Subject: Merge branch 'jk/a-thread-only-dies-once' into maint X-Git-Tag: v1.8.2.2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7a011aac0ef32e1b4835284c3ca6360729d7b83b;p=thirdparty%2Fgit.git Merge branch 'jk/a-thread-only-dies-once' into maint * jk/a-thread-only-dies-once: run-command: use thread-aware die_is_recursing routine usage: allow pluggable die-recursion checks --- 7a011aac0ef32e1b4835284c3ca6360729d7b83b diff --cc git-compat-util.h index e715285e7c,6aee9df868..ad4762499e --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -314,19 -299,9 +314,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);