summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-06 18:21:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-06 18:21:36 (GMT)
commit610a14f643b1dfe188e938492425cc88d96025a8 (patch)
tree419bdf6d93f09a4f3551652be0686ba609870f54 /git-compat-util.h
parentd2a274aa87d69786aa95da2f2eab88aa6b77644f (diff)
parentff0a80af724e81dbad6a269847523e39c2e7e479 (diff)
downloadgit-610a14f643b1dfe188e938492425cc88d96025a8.zip
git-610a14f643b1dfe188e938492425cc88d96025a8.tar.gz
git-610a14f643b1dfe188e938492425cc88d96025a8.tar.bz2
Merge branch 'jk/squelch-compiler-warning-from-funny-error-macro'
* jk/squelch-compiler-warning-from-funny-error-macro: let clang use the constant-return error() macro inline constant return from error() function
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 76910e6..7849d31 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -330,8 +330,12 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)))
* 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)
+#if defined(__GNUC__)
+static inline int const_error(void)
+{
+ return -1;
+}
+#define error(...) (error(__VA_ARGS__), const_error())
#endif
extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params));